Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restarting websphere automatically

Status
Not open for further replies.

sarr

Programmer
Oct 4, 2000
8
US
Here is the scenario..
I am running an application on websphere which contains ejb and connects to AS/400 database. The database goes down every midnight. The applications works only if i restart the websphere server after the database server is started. Is there anyway i can automatically schedule the process of restarting the websphere server everyday.

Thanks,
Sarr
 
This is the same thing that happens to me. I am on AIX connecting to a remote Informix DB. I have found two methods for handling this.

[ol][li]You can schedule a daily reboot of the WebSphere Server. To do this add the following line to your crontab
Code:
MM HH * * * shutdown -rF > /tmp/shutdown.log 2>&1
You need to find the right time (MM=minute, HH=hour) that it is save to reboot your server. This has limitations in that everything on that server will be killed and restarted. Brute force sometimes is necessary.
[/li]
[li]You can call the following script from your crontab that will just kill the java processes and then restart the WebSphere admin server.
Code:
#*** crontab entry
MM HH * * * /scripts/restartWAS.sh > /tmp/restart.log 2>&1

#*** restartWAS.sh script

#!/bin/ksh
cd <WAS_HOME_DIR>/bin

# First kill the WebSphere processes
kill -15 `ps -eo pid,ruser,command | grep java | grep -v <ADD_NON_WAS_JAVA_PROCESSES> | awk ' { print $1 } '`

# Sleep to make sure all the threads die
sleep 12

# Finally restart the WebSphere AppServer
./startupServer.sh &

You need to supply the correct directory structure for WebSphere, and the &quot;grep -v ...&quot; part is only needed if you run other java processes and you don't want to kill them when you kill WebSphere.
[/li][/ol]
I have been searching for a way of stopping WebSphere without the kill command, but so far I haven't found anything.
I hope this helps you. Please let me know if you have any questions about these methods. Einstein47
(Love is like PI - natural, irrational, endless, and very important.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top