in reply to How can i check my script is already running?
ormy @np = `ps aux | grep "/home/shekar/myscript.pl" | grep -v grep`; print "Number of running processes: " . (scalar @np) . "\n";
But I agree with others, you can find better ways to do it.my $np = `ps aux | grep "/home/shekar/myscript.pl" | grep -v grep | wc -l`; chomp $np; print "Number of running processes: $np\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How can i check my script is already running?
by Hue-Bond (Priest) on May 11, 2010 at 16:41 UTC |