On Fri, 8 Nov 2002 13:48:34 -0800 (PST), [EMAIL PROTECTED] (Carol Nguyen) wrote:
>Hello, > >I just subscribed to this list 2 days ago. I am >pretty new to perl. I have one question: I need to >write a little script to auto-start the solaris web >server when it crashes. How am I about to do this >with perl? Any suggestion? This script basically >checks the web application every 15 minutes to see if >it's running. If it's not running, I have to stop and >start the web server. There are a few people who have already made programs to do this. chkproc http://www.maymi.de/work.php #a c program, http://www.tildeslash.com/monit/ If you want to do it yourself, use Proc::ProcessTable and daemonize it with Proc::Daemon Here's a quick example of how to check a script's existence ########################################### use strict; use Proc::ProcessTable; my $t = new Proc::ProcessTable; foreach my $p (@{$t->table}){ if($p->cmndline =~ /myscript\.pl./){ print $p->cmndline," already running!\n"; last; } } ########################################### -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]