[talk] kill -0
fire crow
fire at firecrow.com
Fri May 10 15:37:17 EDT 2019
On Fri, May 10, 2019, 15:32 Edward Capriolo <edlinuxguru at gmail.com> wrote:
>
>
> On Fri, May 10, 2019 at 3:06 PM Pete Wright <pete at nomadlogic.org> wrote:
>
>>
>>
>> On 2019-05-10 11:59, Pete Wright wrote:
>> >
>> >
>> > On 2019-05-10 11:00, Raul Cuza wrote:
>> >> Hola People Who Use Shells,
>> >>
>> >> I just had someone submit a shell script using `kill -0 ${PID}` to
>> >> test if a process is running. It exits non-zero if ${PID} isn't a
>> >> running process and zero otherwise. But...
>> >>
>> >> http://nixdoc.net/man-pages/FreeBSD/kill.1.html says nothing about it.
>> >>
>> >> The ubuntu man page mentions it poorly with "Particularly useful
>> >> signals include HUP, INT, KILL, STOP, CONT, and 0." Looking at `kill
>> >> --list` there is no signal 0.
>> >>
>> >> And stackoverflow says
>> >>
>> https://stackoverflow.com/questions/11012527/what-does-kill-0-pid-in-a-shell-script-do
>> >>
>> >> matching what the person who submitted the PR says.
>> >>
>> >> Am I wrong to think this should be accomplished in a way with better
>> >> documentation? I feel like I am nit picking.
>> >
>> > this seems like a bash'ism - from the bash manpage:
>> >
>> > SIGNALS
>> > When bash is interactive, in the absence of any traps, it ignores
>> > SIGTERM (so that kill 0 does not kill an interactive shell),
>> > and SIGINT
>> > is caught and handled (so that the wait builtin is
>> > interruptible). In
>> > all cases, bash ignores SIGQUIT. If job control is in effect,
>> > bash
>> > ignores SIGTTIN, SIGTTOU, and SIGTSTP.
>> >
>> >
>>
>> heh wish i saw Jan's post before i wrote this as his reply seems to
>> answer the real question...
>>
>> -p
>>
>> --
>> Pete Wright
>> pete at nomadlogic.org
>> @nomadlogicLA
>>
>> _______________________________________________
>> talk mailing list
>> talk at lists.nycbug.org
>> http://lists.nycbug.org:8080/mailman/listinfo/talk
>>
>
>
> It feels safer to me to use ps route. Even if you are counting the os to
> preserve the 0 behaviour I feel I would fat finger it and send a kill -1 or
> 2
>
or more likely fat finger to 9 which is next to 0 on a keyboard
~fire
> _______________________________________________
> talk mailing list
> talk at lists.nycbug.org
> http://lists.nycbug.org:8080/mailman/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nycbug.org:8080/pipermail/talk/attachments/20190510/a9b8aa17/attachment-0001.html>
More information about the talk
mailing list