Hi! I created the following perl subroutine to prevent multiple occurrances of the same script from running. <br>I supply a maximum task count due to the subprocesses perl seems to create for things like globs and the actual grep task! <br>I now would like to kill any previous running occurrances of the script. Given the subprocesses perl creates, it there a best way to do this? For example, if I kill the main perl task, will the child processes die gracefully?<br>I know they will become defunct, but will they also be removed from the process table on Solaris? Or do I need to kill all the child processes first? <br>Any and all suggestions are welcome!<br>Thanks <br><br>sub process_ck{<br> my $mcount = $_[0]; # max task count<br> my $parm = $0;<br> chomp(my @procs = qx!ps -aux¦grep '$parm'!);<br> my ($count, $element);<br> foreach (@procs){<br> if (index($_, $parm) ne -1){<br> $count++;<br> }<br> }<br> if ($count > $mcount){<br> die "Task $parm already running!\n";<br> }<br>}<br>