![]() |
system() not having command exit status
Racked my brain and searched the archives but came up empty on both
instances. :^() I have a script that is grabbing a pid out of a file and then using the exit status of `ps -p` to determine if the process is running. I don't have any of the Proc modules installed so this is the quickest way I could come up with. The problem is that system("ps -p $pid") == 0 is always true. I can run the command at the unix shell and it comes back with $? == 1. My next step is to just create a hash of all the running pids and test against that. Thanks for the help. Tim Code Snippit foreach $Username (@master_list) { if (-e "/home/$Username/dynamo/home/servers/$Username/logs/dynamo.pid") { $fh->open("< /home/$Username/dynamo/home/servers/$Username/logs/dynamo.pid") ; $pid = <$fh>; }else{ next } $ENV{DYNAMO_HOME} = "/home/$Username/dynamo/home"; # Now we check to see if that PID is a valid process and if so issue the # stopDynamo command for that particular users instance; $cmd = "ps -p $pid >/dev/null"; $kill_cmd = "/home/$Username/dynamo/home/bin/stopDynamo $Username -kill"; #system($cmd) == 0 and system($kill_cmd); print system($cmd),"\n"; } # End foreach |
Re: system() not having command exit status
Tim F. wrote:
> I have a script that is grabbing a pid out of a file and then using > the exit status of `ps -p` to determine if the process is running. I > don't have any of the Proc modules installed so this is the quickest > way I could come up with. perldoc -f kill ;# Look for the paragraph with "zero" -Joe -- I love my TiVo - http://www.inwap.com/u/joe/tivo/ |
| All times are GMT. The time now is 04:13 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.