if ARGV.size == 0
puts "pass argument"
else
res = `ps aux | grep '#{ARGV[0]}' | awk '{print $2}'`
end
pids = res.split("\n")
puts pids
pids.each {|e|
if Process.pid.to_s != e
puts `ps -p #{e} -o pid,vsz=MEMORY -o user,group=GROUP -o comm,args=ARGS`
puts `kill -9 #{e}`
puts "killed"
end
}
puts "all process are killed and resources releived to Kernel"
No comments:
Post a Comment