Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Killing a shell script from within a perl script

by walto (Pilgrim)
on Mar 03, 2010 at 17:35 UTC ( #826469=note: print w/replies, xml ) Need Help??


in reply to Killing a shell script from within a perl script

An (Linux) approach without threads (not tested):
LOOP1:while($run_count<max) { my $pid = `pidof sh1.sh`; unless ($pid eq ''){ print "Killing Process sh1.sh PID=$pid\n"; kill $pid; sleep 1; next; } else { $shell_out = system("./sh1.sh"); $run_count++; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://826469]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2021-01-27 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?