|
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
mbenton
Joined: 08 Feb 2010 Posts: 38 Country: United Kingdom |
|
24x7 MP 4.3.293 - Job to Shutdown / Auto-Restart ? |
|
Hi,
I would like to create a 24x7 Job to Auto-Restart the scheduler, or at least Shutdown the scheduler in a clean manner.
I have seen example scripts for performing a restart for a Windows scheduler, but not for a Linux based scheduler.
What method/code would you recommend to shutdown/restart a 24x7 MP server ?
|
|
Tue Aug 03, 2010 5:24 am |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7854
|
|
|
|
If you are running it on Windows system as a service, the same method could be used, create and schedule a batch file to restart the service
NET STOP "24x7 Scheduler"
NET START "24x7 Scheduler"
Please check the service name it may be a bit different in different versions
If you are running it on *nix system, create and schedule a shell script to restart the daemon using 24x7_constrol.sh script
./24x7_constrol.sh stop
./24x7_constrol.sh start
|
|
Tue Aug 03, 2010 8:50 am |
|
|
mbenton
Joined: 08 Feb 2010 Posts: 38 Country: United Kingdom |
|
|
|
Thanks for the quick reply :-)
Sorry, this might be a silly question, but where is the "24x7_constrol.sh" script ? Cannot find it in the Scheduler install directory.
[24x7 Scheduler MP 4.3.293 on Red Hat 5.x]
|
|
Tue Aug 03, 2010 10:30 am |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7854
|
|
|
|
Here is the code of that file
|
|
#!/bin/sh
###########################################################
# The first parameter must be either 'start', 'check',
# or 'stop', for example:
#
# ./24x7_control.sh start
###########################################################
if [ "$1" = "start" ]
then
# start 24x7 if it is not already running
ps -ef | grep -v grep | grep jscheduler.jar
if [ $? -eq 1 ]
then
echo "Starting Alert Center server..."
./master.sh nogui &
echo "Scheduler started."
else
echo "Scheduler already running."
fi
elif [ "$1" = "check" ]
then
# check 24x7 is running
ps -ef | grep -v grep | grep jscheduler.jar
if [ $? -eq 1 ]
then
echo "Scheduler is not running"
rsh <mail> mailx -s "<Scheduler>" <mail>
exit 1
else
echo "Scheduler running."
fi
elif [ "$1" = "stop" ]
then
# find and kill the process
ps -ef | grep -v grep | grep jscheduler.jar
if [ $? -eq 1 ]
then
echo "ERROR: Scheduler not running."
exit 1
else
ps xu | grep -v grep | grep jscheduler.jar | awk '{ print $2 }' | xargs kill -9
echo "Terminate signal has been sent to Scheduler process."
fi
else
echo "ERROR: Invalid command line parameters"
echo "Example 1: ./24x7_control.sh start"
echo "Example 2: ./24x7_control.sh stop"
echo "Example 3: ./24x7_control.sh check"
exit 1
fi |
|
|
Tue Aug 03, 2010 2:25 pm |
|
|
mbenton
Joined: 08 Feb 2010 Posts: 38 Country: United Kingdom |
|
|
|
Magic. Just what I was looking for. Manny Thanks :-)
|
|
Wed Aug 04, 2010 5:14 am |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7854
|
|
|
|
I'm sorry, I've noticed that the message board engine is removing text appearing in HTML like format. Here is re-posted script, using double quotes instead of brackets for HTML tags.
|
|
#!/bin/sh
###########################################################
# The first parameter must be either 'start', 'check',
# or 'stop', for example:
#
# ./24x7_control.sh start
###########################################################
if [ "$1" = "start" ]
then
# start 24x7 if it is not already running
ps -ef | grep -v grep | grep jscheduler.jar
if [ $? -eq 1 ]
then
echo "Starting Scheduler..."
./master.sh nogui &
echo "Scheduler started."
else
echo "Scheduler is already running."
fi
elif [ "$1" = "check" ]
then
# check 24x7 is running
ps -ef | grep -v grep | grep jscheduler.jar
if [ $? -eq 1 ]
then
echo "Scheduler is not running"
rsh "mail server here" mailx -s "Scheduler process not running" "mail.id"
exit 1
else
echo "Scheduler is running."
fi
elif [ "$1" = "stop" ]
then
# find and kill the process
ps -ef | grep -v grep | grep jscheduler.jar
if [ $? -eq 1 ]
then
echo "ERROR: Scheduler is not running."
exit 1
else
ps xu | grep -v grep | grep jscheduler.jar | awk '{ print $2 }' | xargs kill -9
echo "Terminate signal has been sent to Scheduler process."
fi
else
echo "ERROR: Invalid command line parameters"
echo "Example 1: ./24x7_control.sh start"
echo "Example 2: ./24x7_control.sh stop"
echo "Example 3: ./24x7_control.sh check"
exit 1
fi
|
|
|
Wed Aug 04, 2010 8:32 am |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|