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.
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
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?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.