Re: cron problem
Jacob Smullyan <[email protected]> Tue, 7 Jun 2005 12:11:35 -0400
| Newsgroups | gmane.comp.web.skunkweb |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Jun 07, 2005 at 08:33:35AM -0700, Spruce Weber wrote:
> The python script executed by cron to make sure skunkweb is running
> stopped working after I was moved from one server to another.
>
> The script is called restartSkunkWebIfNeeded.py, from
> python-hosting.com, and it works when executed from my bash login.
>
> In my config I noticed a sys.path.append referring to a non-existant
> "sitelibs" directory directly under my skunkweb installation directory.
> Could that be a problem?
No. A non-existant directory on sys.path doesn't do any harm.
>
> The path to my skunkweb installation and document root directories has
> not changed on the new server.
>
>
> restartSkunkWebIfNeeded.py:
>
> #!/usr/local/bin/python2.1
>
> # Check if SkunkWeb is running and restart it if it isn't
>
> import os,sys
> skunkHome=os.path.dirname(sys.argv[0])
>
> running=0
> try:
> f=open(skunkHome+'/var/run/sw.pid')
> pid=f.readline()
> f.close()
> res=os.popen('ps -aux | grep %s'%pid).readlines()
> for r in res:
> if r.find('grep')==-1: running=1
>
> except IOError: pass
>
> if not running:
> os.system(skunkHome+"/bin/swmgr start")
>
Well, without knowing what actually fails I can't say. I'd run this
by Remi. I suggest adding better error reporting to the script so you
can tell what failed.
Once skunkweb is up, it is really unlikely that it will go down unless
there is a reboot. I have never seen the papa process crash. But
python-hosting machines do seem to reboot from time to time, so you
want something to make sure it comes up.
You could also use a simpler cron just to deal with reboots:
#! /bin/bash
PID=/path/to/pid
SWMGR=/path/to/swmgr
[ ! -f $PID ] && $SWMGR start
Very primitive, but if it dies you'll know why.
Cheers,
js
--
Jacob Smullyan
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCpcc3uqamFyFXXLIRAoq5AKCFPeQrGgfSwAbwODE0E4VGpYYSFwCfThFq STvccWXO+727aGN4EwhfrjE= =c1F/ -----END PGP SIGNATURE-----