Instead of running "./webrestart", I'd likely be tempted to do that in perl directly, especially so I could get a small delay between the pkills and the pkill -9's (say, a half-second, which not all 'sleep' commands can do) to give fastcgi time to close down cleanly before being brutally virtually murdered ;-)
Also, I'm thinking that "pkill fcgi" is going to also kill fcgi-pm - after all, pkill is just grepping through the process list, and "fcgi" will match against "fcgi-pm" too. This leaves me with:
Though, to be honest, I'd probably create an init script for this in my /etc/init.d, yes, probably in shell, and then just call /etc/init.d/fastcgi restart instead.use Time::HiRes qw(usleep); use File::Spec; # this should be near, if not combined with, the @urls list to encoura +ge keeping them in sync # which is far better than doing this in a separate file! # (you may be able to even just use the @urls array to generate this l +ist, even better!) my @sites = qw( /path/to/site/one /path/to/other/site ); sub fastcgi_restart { system qw(pkill fcgi); usleep(500); system qw(pkill -9 fcgi); for (@sites) { # probably should pick a unique name for the socket somehow, but I +'ll leave that # to you - I'm just copying your code here. system File::Spec->catfile($_, 'fastcgi.pl'), qw(-l /tmp/mysite.so +cket -n 3 -d); } }
Really cool, of course, would be to write an init script in perl that actually read your lighttpd configuration to determine the URLs and paths completely automatically, and could check the status, start, stop, and restart the fastcgi stuff. Then I'd have a cron job like this:
(This assumed that lighttpd's status worked the way you want/need, i.e., intutitively.)#!/bin/sh if ! /etc/init.d/lighttpd status > /dev/null; then /etc/init.d/lighttpd status fi if ! /etc/init.d/fastcgi status > /dev/null; then /etc/init.d/fastcgi restart fi
Just my two cents. :-)
PS: ++ for trying to get your computer to do your work for you :-) It's a perfect example of Laziness.
In reply to Re: Keep FastCGI Processes Up and Running
by Tanktalus
in thread Keep FastCGI Processes Up and Running
by SouthFulcrum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |