hi I have successfully got cherrypy (installed in a virtualenv) running a 'hello world' and if I change the message, the web page is updated, the question is how do I stop and start the app? (this so I can then set a cron job to restart the app in case of server boot or app crash) This post http://community.webfaction.com/questions/11386/how-do-i-restart-my-cherrypy-application provides a solution, it seems providing you can find your PID - my app doesnt seem to have a PID or I can't find it. If I do cat $HOME/tst1/pid or cat $HOME/webapps/tst1/pid I get 'No such file or directory. How do I find the PID or stop and start without having a PID? asked 15 Dec '13, 16:26 merv |
You can run this command to find the pid,
the process will be the one which shows the path to the python binary and the name of the script. I was able to determine this on your account and if you send us a support ticket we can show you the exact commands and output. You can use this script to maintain the process with cron. answered 15 Dec '13, 17:40 johns thanks, so that's how to kill the process but could you pls advise how I should launch my hello world app (sand.py)? The script you link to above needs to locate the apps pid file - and it seems...
Any advice appreciated.
(16 Dec '13, 13:17)
merv
thanks, so that's how to kill the process but could you pls advise how I should launch my hello world app (sand.py)? The script you link to above needs to locate the apps pid file - and it seems... If I just do 'python sand.py' then my process is attached to the SSH session (and there is no pid file) If I do 'python sand.py &' then I only have a generic python process to kill - and that seems a bit risky in case I link to the wrong python process (and there is no pid file) I've tried running 'cherryd -p pid sand.py' (locally) with various arguments, and while this creates a useful PID file and seems to run, I don't get 'hello world' returned from the app via the web page (empty content is successfully returned - no doubt I am missing a crucial argument). Any advice appreciated.
(16 Dec '13, 17:59)
merv
The watchdog script creates the PID file, so that's the right way to solve the problem. You would basically be using that same script with this line:
(16 Dec '13, 19:07)
ryans ♦♦
|
So this was not so hard. By allowing the watchdog script launch the app, this takes care of the PID file. So all I had to do to get cron working was create the cron directory and add the above watchdog script with this single edit:
then
then wait 5 mins for crontab to launch and all is fine. If I manually kill the process, after a <5 min interval, it relaunches. Great! Thanks for the help, answered 17 Dec '13, 06:07 merv |