Hello everyone, I have a script that has been working for a while but has stopped due to the output of ps.
Basically all I do is pipe the input from ps into my perl program, and grep for cdlor.....but the path to perl has moved (long story) and the cdlor isn't printed in the command output from ps. Anyone have a similar script? I've looked at Proc::ProcessTable, and it gives me everything I need, but I need a safe way to kill the processes. Any ideas? Here's my script: #!/usr/bin/perl -w $regex = '^\s{0,4}(\d{1,7})\s?(\d{2}:\d{2}:\d{2}|\s{0,3}\w{4}\d{2})\s{0,8}(\d{1,4} -?)?(\d{2}):(\d{2}):(\d{2})'; $pipe = open(PH, "ps -eo pid,stime,etime,comm \| grep cdlor |"); while( <PH> ) { #foreach $el (@line) { #if(<PH> =~ /$regex/) { if($_ =~ /$regex/) { $pid = $1; $stime = $2; $days = $3; chop($days); $hours = $4; $min = $5; $sec = $6; print $_; print "Pid: $pid Stime: $stime Days: $days Hours: $hours Min: $min Sec: $sec\n"; if ($stime =~ /[A-Z]?[a-z]+/ && $days || $hours >= 12 && !$days) { push @pids, $pid; } foreach $p (@pids) { $count{$p}++; print $p . "\n"; next if $count{$p} >= 2; @sysargs = ("kill", $p); system("kill $p") == 0 and print "$p killed\n"; # or die "system @sysargs failed $?"; } -- Kevin Old <[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]