Saturday, August 2, 2008

Linux Commandline Restart Ahsay OBS

So, much for montly postings. Here's a good one.

Here's a very quick way to restart Ahsay's OBS cleanly and without impacting backup clients. The software client will reconnect (much like a network bump).

1. First line is #!/bin/bash
2. Place contents in a filed called "restartAhsay.bash"
3. #chmod 700 restartAhsay.bash
4. Restart! #./restartAhsay.bash

#!/bin/bash

echo `date` >> /root/restartLog.txt
echo "Stopping OBS" >> /root/restartLog.txt
nice -19 service obs stop

sleep 2

pid=`ps -ef |grep obs |grep -v grep | awk '{ print $2 }'`
if [ $pid ]; then
kill -9 $pid
fi

nohup nice -19 service obs start

echo `date` >> /root/restartLog.txt
echo "OBS Started" >> /root/restartLog.txt
echo >> /root/restartLog.txt

echo "OBS Server Restarted at `date`" mail -s "Peak Backup OBS Restart Status" e-mail@peakbackup.com