#!/usr/bin/perl
@s=`ps aux`;
if(! $ARGV[0] )
{
print "Pass the arguement \n\n USAGE: pk processname (ex: firefox)\n";
exit;
}
foreach $i (@s)
{
if(($i=~/$ARGV[0]/i)&&($i!~m/processkill/i))
{
print "Killing $ARGV[0] Process\n";
@processlist=split(" ",$i);
system("kill -9 $processlist[1]");
}
}
scriptname process_name_to_kill (eg firefox )
@s=`ps aux`;
if(! $ARGV[0] )
{
print "Pass the arguement \n\n USAGE: pk processname (ex: firefox)\n";
exit;
}
foreach $i (@s)
{
if(($i=~/$ARGV[0]/i)&&($i!~m/processkill/i))
{
print "Killing $ARGV[0] Process\n";
@processlist=split(" ",$i);
system("kill -9 $processlist[1]");
}
}
scriptname process_name_to_kill (eg firefox )
No comments:
Post a Comment