#!/usr/local/bin/perl $sig = 15; if ($ARGV[E0] =~ /-(.*)$/) { $sig = $1; shift @ARGV; } unless (@ARGV == 1) { die "Usage: $0 [<signal>] <process name>"; } $name = $ARGV[0]; @proc = split(/\n/, `ps -e`); foreach (@proc) { $ps = substr($_, 21); s/^\s+//; @f = split(/\s+/); if ($ps =~ /^$name/) { $! = undef; kill $sig, $f[0]; print STDERR "kill -$sig $f[0] : $!\n" if ($!); $flag = 1; } } die "Killed no processes" unless ($flag);
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 1472 | Yariv Sheizaf | scripts dir |