DAC Restart Script

Hi,

Just thought I would share the script I wrote to restart your DAC server in the event of a crash, this can be helpful during the night as there is no need for a manual restart.

I used a cron job to check to see if the process is running every 5min.


#!/bin/ksh

#########################################################
 # NAME:email_dac_restart.sh #
 # AUTHOR:  #
 # DESC: Makes sure dac is running and restarts if not #
 # VERSION: 18/1/13 #
 # CHANGE LOG: #
 #########################################################

. ~/.profile

if ps -ef | grep '/usr/jdk/instances/jdk1.6.0/bin/sparcv9/java -server -Xmn500m -Xms2048m -Xmx204'
 then
 echo 'do nothing'
 ## tail -1 $DAC_HOME/nohup.out | mailx -s 'DAC Running TST1 ' your@email.com
 else
 cd $DAC_HOME
 nohup $DAC_HOME/startserver.sh &
 tail -200 $DAC_HOME/nohup.out | mailx -s 'DAC Restarted  ' your@email.com
 fi

exit
 EOF

Any improvements or comments are welcome

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s