create the file /root/bin/web2pytest.sh to check if web2py runs and start web2py if it is not running
if
! ` netcat -z localhost 8000 `
then pgrep -flu myusername web2py | cut -d\ -f1 | xargs kill > /dev/null 2>&1
chown myusername: /var/log/web2py.log
su myusername -c 'cd /home/myusername/web2py && ./web2py.py -p 8000 -a password 2>&1 >> /var/log/web2py.log'
sleep 3
if
! ` netcat -z localhost 8000 `
then echo "web2py/sysbio could not be started!"
else echo "web2py/sysbio was restarted"
fi
fi
now add the following line to crontab to execute the script every 3 minutes
*/3 * * * * /root/bin/web2pytest.sh > /dev/null
thanks to Ivo Maintz, you da best :)
Comments (2)
0
virtualdisaster 14 years ago
0
select 14 years ago