Z
Zilani
Guest
To kill a process in terminal I used following commands:
to find the pid:
ps -ef |pgrep "process name"
to kill the process:
kill SIGKILL pid
Can this be done by using a single command? I was trying to do this in script
########
pid=os.system('ps -ef |pgrep "%s"'%process_name)
command=str('kill SIGKILL %s'%pid)
os.system(command)
########
But this does not work and I have found the pid was always returned 256. How can I do this? I'm new to script writing. It'll be great if anyone can explain.
to find the pid:
ps -ef |pgrep "process name"
to kill the process:
kill SIGKILL pid
Can this be done by using a single command? I was trying to do this in script
########
pid=os.system('ps -ef |pgrep "%s"'%process_name)
command=str('kill SIGKILL %s'%pid)
os.system(command)
########
But this does not work and I have found the pid was always returned 256. How can I do this? I'm new to script writing. It'll be great if anyone can explain.