I run web2py on shared hosting. I don't have root access so I had a similar 
problem getting it to run as a started task. I ended up with a totally 
different solution which still makes sure web2py runs for me at all times. 
It's a bit of a hack.

I created a bash script called run_web2py and put it in crontab to run 
every minute. It is wrapped in a flock, so if it is already running it 
quietly exits, but if the lock is not found it will start web2py for me. I 
used to run my run_web2py script at boot time with a line in crontab 
starting @reboot but I couldn't get that to work for some reason. This 
approach works for me.

The line in crontab says
* * * * * run_web2py

The run_web2py script is a file in my $PATH.

run_web2py contains:

#! /usr/bin/env bash
# get an exclusive lock or quit
exec 200<$0
flock -n 200 || exit

rm web2py/applications/tgaa/cache/*
nohup ~/python27/bin/python ~/web2py/web2py.py -p portnumber -a password &

(I remove the cache files because in the past I have had problems starting 
web2py unless the cache files are deleted.)

The flock incantation I sole from here: 
http://stackoverflow.com/questions/7057234/bash-flock-exit-if-cant-acquire-lock/7057385#7057385
.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to