I have a service that are not 100% stable and stops from time to time.
So I have a script that do restart the service if it does not run.
This script works win on Ubuntu 9.04 but will not start the service in Ubuntu 10.10
If I run the part that do starts the service from CLI, it starts normal.
Any idea of what is wrong?
This runs fine manually
/var/bin/Server.x86 &
Script
#!/bin/sh
date=`date`
echo "-------------------------------------------------" >> /var/bin/checksvc.log
echo "Restarting Server : $date" >> /var/bin/checksvc.log
echo "-------------------------------------------------" >> /var/bin/checksvc.log
while [ 1 ]
do
pidof Server.x86 >/dev/null
if [ $? -eq 0 ] ; then
echo ""
else
date=`date`
echo "Restarting CCcam : $date" >> /var/bin/checksvc.log
/var/bin/Server.x86 &
if [ $? -eq 0 ] ; then
echo "ok!"
else
echo "hm, didn't work. Try doing it manually"
fi
fi
sleep 30
done