WLST Detect / Start Weblogic server - java

I use Weblogic server for my application and am trying to automate data source update task.
So, I have a script (UpdateDataSource.py) which updates the data source to what I need.
Now, I need Weblogic to restart once the data source has been updated. So I am trying something like;
call wlst UpdateDataSource.py
call startWebLogic.cmd
But my question is after I update the data source through script, I do not want to directly start the weblogic server (I need to close the existing one and then start)
How do I automate the same?

I'm not very sure about your question.
1. If you want to shutdown the WLS, use shutdown command in WLST
2. if you want to start WLS in another window, add "start" before the call command, like:
start call startWebLogic.cmd

Related

Stop a minecraft server from an other cmd windows

i want to stop a Minecraft server (java) from an empty cmd window (in the server window, we just can type "stop" to stop the server),
because I want to automatize the start and the stop of the server with os library with :
os.system("the command i search")
I don't want to kill the task , because with this method, the server is not stopped properly, and we lost a lot of data.
As for automation of the start of the server, that's simple. Either put a shortcut to your server file in your Startup folder in Windows or put a shortcut to your run.bat file in the same folder. For shutting it down, that might be a pain. I can tell from using the os.system() method that you're using Python. Stopping the server from a clear command window is something I don't know how to do, but I did find a "life-hack" you can do. This plugin is made to automatically restart your server at a specific time of day. But you should be able to configure it to just shut down, instead of a restart. Even if you made it restart, you could make the PC it's hosted on shut down just after the server restarts. This would cause a crash, granted, but it would also save all progress.

Java: Listen to directory change on a remote Linux server

I have a Spring web application which triggers a SAS job on a remote Linux server, the SAS job will generate a result file on the remote server upon finished. I need to display the result on my Spring application, so I want to create a listener for the directory changes on the server.
I have being looking at the java.nio library, but it looks like it only works local directories. Any ideas other than keep pinging the server through ssh? Thanks!
You might use FTP from org.apache.commons.net.ftp
Using FTP (or any other Java FTP library), you only need to check for the content on the remote directory.
If the directory supposedly is always empty, then when the first file appears your process will be triggered.
If the directory is not always empty, you might need to implement something to control which files are new, and which are not.
Please let me know if you need further assistance.

Upload something a running file in php

I know it sounds strange. I've a php file on my server which is responsible for handling uploads. And a java program on my desktop sends files to this php file. I want to cancel the file upload process to the server whenever I want. So I want to create a kind of stream or something like that to stop ongoing upload process.
I tried to use PIDs to stop a php file's running. But a php file doesn't start running before the client finished uploading.
I want to run the "savePid()" function before the upload started. So I can get the PID and stop running of the file whenever I want.
<?php
include('func.php');
savePid(); //run this before upload started
$in = stream_get_contents(fopen("php://input", "rb"));
$out = fopen('pipeupload.txt', 'w');
while ( ! feof($in) ) {
fwrite($out, fread($in, 8192));
}
?>
I know this won't work. I'm just looking for a solution to stop an ongoing upload process.
It might be possible on server side.
Example :
You have 20 images, every image is more than 2 mb in size. Your java
file from desktop send array of url's of images which is ready to
upload by php file as you told. In the php file you have to do some
change, before every image upload you have to check in database
(create table and add new field image_cancel or add this field in your
prev table, set default value is false) column name image_cancel is
true/false. if it true then stop execution and exit. Now create a new
script cancel_image.php ---> Write code inside and set image_cancel
field true.
This is not an easy thing to do.
There are couple of options I can think of, but both are not easy. Easier first
First Method:
You should have 2 PHP scripts one for handling the upload (which you have now) and another to notify the client to abort. The client should upload to the upload script as you are doing now, and also regularly check if an abort is posted at the notify script. Once the client finds abort it aborts the rest of the upload. Thus your file never reaches the PHP file handling the upload. This method requires the client to handle the abort. A client not respecting the abort still can upload the full file.
Second Method:
You should write your own file handling module or application instead of the normal web server. You can also write apache module which hooks into file upload (if your web server is apache). But this method is more complex and will not run on web servers if you are not hosting it. This method requires patching the webserver or installing application working at system level, and I don't think any administrator will allow this on their server.

Stop the server using batch file?

Can we stop servers using batch file?
I am using Weblogic (v10) application server.
I want to stop the server or kill the process using batch file.
my application contains three Weblogic instances(Admin Server, Application Server ,Registration Server).
Please tell me how can we stop servers using batch file?
I believe it's possible to script all interactions with WebLogic instances, so my guess is "yes", it can be done.
Yes.
I think iv just found it on Google.
See Starting / Stopping WebLogic Server and notice that you will need to first setup your environment to use the Command-line Commands.

NativeProcess API Java Debugging?

What is your way to debug Java side when nativeProcess.standardInput.write method is invoked by Flex side? I know that it is possible but don't know how?
To be able to attach your Eclipse debugger to a running Java process you need to start that process with the following Java options…
-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n
Once you have done this and have restarted the server, you can use your Eclipse to attach to the running process. From Eclipse go to the Debug manager and create a new Remote Java Application configuration for the process you want to connect to. Set the port number to 8001, the same as that of the options. You will also need to enter the hostname for the machine running the Java process. That is pretty much it…

Categories

Resources