Hi,
I like to have a web2py running on my server even if it crashes for some
reason or the server is rebooted. I found this web2py slice:
http://www.web2pyslices.com/slice/show/1422/cron-script-for-checking-if-web2py-runs
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
but I got pretty much no idea what it is doing. from my understanding this
shell script checks if there is a localhost port 8000 is closed
if it is it does a lines which I got no idea what it does
than it is doing something with a logfile
after that web2py is started locally?
after 3 seconds it writes if web2py could be started.
Am I somewhat correct with my interpretation?
If I wanted to use that script on my server I have to replace localhost
with my servers ipaddress?
myusername would be root?
Do I use port 8000 on a server with a public website?
sry I'm pretty new to linux command line stuff, shell scripts,
serveradministration...
--