我想在杀死进程时挽救“不允许操作”,但我不知道如何!
def kill(process)
process.each do |line|
if line.include? "java"
process_no = line.split[0]
`kill -9 #{process_no}`
end
end
end
while true
retry_count += 1
# check if tomcat is alive!
tomcat = `ps axf | grep tomcat`
process = tomcat.split(/\n/)
if checkPID(process)
print "."
if retry_count < 3
print "."
else
puts " try to kill.."
begin #=>=(((it doesn't work
kill(process)
rescue Exception => e
puts("")
break
end #=> =((((
end
我在 while 循环中检查它,但它不起作用。