[mythtv-users] backend monitoring scripts?
Leo Kliger
lkliger at bigpond.net.au
Sat Dec 9 09:45:22 UTC 2006
On Sun, 2006-11-26 at 09:56 -0400, Paul A Pick wrote:
> > Do anyone have any scripts which monitor the backend?
> > ie if it crashes automatically restart and/or notify status
> > etc...
> ...
> > Ideally something easy to configure would be good.
I wanted something like this myself but the sample script didn't work
for me because I don't run mythweb.... so using it as a guide I have
tried to write something that will work on any Linux box....
Like the earlier script you just need to save it to a file and make it
executable before putting into your crontab.....
I'm not a programmer so be kind with any comments:)
Here it is:-
########################################################################################
#!/bin/sh
#
# A simple script to restart the backend when it appears to have died.
#
#
# Set PID variable
PID=/tmp/myth_kick.$$
#
# Get the mythbackend PID and reset variable
#
touch $PID
echo `ps -C mythbackend -o pid=` > $PID
PID1=`cat $PID`
#
#
# If statement which re/starts the mythbackend if the PID variable is empty
#
if [ "$PID1" = "" ];
then
echo "############## `date` ###############"
echo "Backend is not running - might do something about this"
echo
echo "Restarting backend."
/etc/init.d/mythbackend start
echo "####################################################"
#
# Uncomment the next 4 lines if you want to be told that the mythbackend is has a PID
#else
# echo "############## `date` ###############"
# echo "Backend is running - nothing to worry about"
# echo "####################################################"
fi
#
# Let's be good and clean up after ourselves;)
#
rm $PID
##############################################################################################
More information about the mythtv-users
mailing list