bergman on 24 Sep 2009 07:52:11 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] correct way to do this in bash



In the message dated: Thu, 24 Sep 2009 07:30:06 +0200,
The pithy ruminations from sean finney on 
<Re: [PLUG] correct way to do this in bash> were:
=> 

=> 
=> On Wed, Sep 23, 2009 at 06:06:50PM -0400, JP Vossen wrote:
=> > The easy way is to use pkill (as Sean noted), or pgrep (same thing), or=
=> =20
=> > killall (as I noted in my sample script).
=> 
=> anyone who has ever adminned a sun box will vote against using killall :)

I "grew up" on Solaris (well, SunOS and H/UX and Mt. Xinu BSD on Vaxen before 
Solaris). Even though 90%+ of my admin work in recent years has been on Linux, 
I still don't use killall...and the rare times that I encounter it, I check the 
man page carefully.


=> 
=> behavior of killall on linux: kill all processes matching a specific name.
=> behavior of killall on solaris: kill all processes (and ignore argv[1])

Yeah, that's gonna hurt.



Here's another one...imagine the following sequence of commands run as root:

	someserver# command1 &
	someserver# command2 &
	someserver# command3 &
	someserver# kill %3
	someserver# kill %2
	someserver# kill  1

Ooops! Forgot that little tiny "%"...you've just killed "init". Actually, the 
last few times I played around with this, the init() processes takes more than
just "kill" w/o specifying the signal to kill it. This was not always the case. :(

Mark

=> 
=> 
=> 	sean
=> 
=> --=20
=> 
=> --QKdGvSO+nmPlgiQ/
=> Content-Type: application/pgp-signature; name="signature.asc"
=> Content-Description: Digital signature
=> Content-Disposition: inline
=> 
=> -----BEGIN PGP SIGNATURE-----
=> Version: GnuPG v1.4.10 (GNU/Linux)
=> 
=> iD8DBQFKuwPeynjLPm522B0RAir7AJ49KHYXUBD8xJHqkwUUPIOvMhuVMQCeMRrW
=> vcoLlpeQyRD4Tp2pHFQnSvw=
=> =Ma9c
=> -----END PGP SIGNATURE-----
=> 
=> --QKdGvSO+nmPlgiQ/--
=> 
=> --===============0433099289==
=> Content-Type: text/plain; charset="us-ascii"
=> MIME-Version: 1.0
=> Content-Transfer-Encoding: 7bit
=> Content-Disposition: inline
=> 
=> ___________________________________________________________________________
=> Philadelphia Linux Users Group         --        http://www.phillylinux.org
=> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
=> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
=> 
=> --===============0433099289==--
=> 



___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug