Re: cron problem

"Spruce Weber" <[email protected]> Tue, 07 Jun 2005 10:48:57 -0700
Newsgroups gmane.comp.web.skunkweb
Message-ID <[email protected]>
I'll try the simpler bash script and see what error message it gives me
next time the system is rebooted.

Thanks,

Spruce

On Tue, 7 Jun 2005 12:11:35 -0400, "Jacob Smullyan"
<[email protected]> said:
> 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


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20