Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Technical Support _ Using Killall On Processes Started By Nohup

Posted by: catbutt Nov 13 2002, 03:33 PM

I often start background processes with the "nohup" command followed by an "&". If I do a "ps -aux", I see the process listed as being "bash" followed by the process name.

The problem is that the processes often cannot be killed by "killall", presumably because it thinks the process name is "bash", and I don't want to kill all processes named bash. I have to use "kill" and the process id, which is hard to script. Is there something I am doing wrong? I know there must be an easy and reliable way to write a script that kills a process running in the background.

Posted by: chrisw Nov 13 2002, 03:45 PM

that is how you have to kill a process that is backgrounded....you have to use kill with the process id

Posted by: catbutt Nov 13 2002, 06:24 PM

Thanks for the quick reply.

So.....how do I get the process id if I am doing it with a script? Do I have to use some sort of awk script on the output of ps? I don't know awk, so I guess I could write a custom program in c to parse out stuff out of ps, but I'm sure there is a more standard way to do it. Anyone have a script or other technique to do this?

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)