Duncan <1i5t5.dun...@cox.net> wrote:
>
>Depending on your "brand" of "unix", "killall" will likely work better 
>for you.  It'll allow you to avoid all that grepping for the pid, etc.
>You could also avoid the "if" logic that way.  If pan's running, it'll 
>kill it, if not, no harm done.  Also, at least on normal Linux, SIGTERM 
>is killall's default, so it need not be specified explicitly.

FWIW, it's also kill's default, so it need not be specified explicitly
with kill either - but in some cases it may be nice to be explicit.

>The catch of course is that while some unixen (including Linux) use 
>killall as a "string" form of the kill command, some others use it as a 
>literal "kill all", and send pretty much everything the same kill signal, 
>effectively taking down the system.  IIANM Solaris works this way.

YANM. Though actually only root is allowed to use killall at all on
Solaris.

>I don't know about the BSDs.

Same as Linux.

> So a script using killall wouldn't be 100% portable.

The mostly-portable way is to use pkill instead - originated in Solaris,
but exists at least in current and semi-current versions of Linux and
*BSD too. Its buddy pgrep is also very handy, to avoid the 'ps | grep |
grep -v' song-and-dance in cases where you want to do something other
than kill.

--Per Hedeland


_______________________________________________
Pan-users mailing list
Pan-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/pan-users

Reply via email to