On Tuesday, September 23, 2003, at 04:57 PM, John Clarke wrote:
On Tue, Sep 23, 2003 at 04:38:12PM +0000, Voytek wrote:
OK, we know you can use other commands to kill processes by name, but can anyone answer Voktek's question, or explain why the documentation for kill seems to imply that the kill command can kill by name if it can't?
bash has a built-in kill command which doesn't understand '-p', so try using /bin/kill instead.
/bin/kill can *sometimes* kill by name (Redhat 7.3). I discovered a couple of stale ssh processes hanging around so I decided to try it. I didn't want to kill *all* ssh processes because I was still using some of them, so I passed the '-p' switch to tell kill to print the pids rather than send any signals.
Here's what ssh processes are actually running:
[EMAIL PROTECTED] ~]$ ps axf|grep ssh
15772 pts/8 S 0:03 | \_ ssh wombat.vastsystems.com.au
29541 pts/10 S 0:00 \_ ssh taipan.kirriwa.net
1440 ? S 0:03 ssh-agent
26989 ? S 0:00 ssh cvs.vastsystems.com.au -l johnc cvs server
26992 ? S 0:00 ssh cvs.vastsystems.com.au -l johnc cvs server
11362 ? S 0:00 /usr/sbin/sshd
If I try to kill ssh, it doesn't work:
[EMAIL PROTECTED] ~]$ /bin/kill -p ssh kill: can't find process "ssh"
but if I try ssh-agent or xterm, it does work:
[EMAIL PROTECTED] ~]$ /bin/kill -p ssh-agent 1440 [EMAIL PROTECTED] ~/tmp/photos]$ /bin/kill -p xterm 15525 15553 15625 15662 15693 15724 15770 11077 30608 19041 29539 31079
Cheers,
John -- whois [EMAIL PROTECTED] GPG key id: 0xD59C360F http://kirriwa.net/john/ -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
-- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
