Timeline for What does `kill -0` do?
Current License: CC BY-SA 4.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Sep 9, 2021 at 9:53 | history | suggested | Grisha Levit | CC BY-SA 4.0 | Added man page links |
| Sep 8, 2021 at 21:26 | review | Suggested edits | |||
| S Sep 9, 2021 at 9:53 | |||||
| Aug 31, 2019 at 9:06 | comment | added | gboffi | I'd l like to add that on Debian kill (1) mentions the 0 signal as important but does not explain its meaning (kill (2) is OK in this respect) — a bug was reported against the relevant package (procps) on 13 May 2018 but as today (31 Aug 2019) no action, not even an acknowledgment, was taken by the maintainers. | |
| S May 29, 2019 at 17:12 | history | suggested | JamesL | CC BY-SA 4.0 | made the final code block display correctly (had to "fix" random stuff for 6 char limit) |
| May 29, 2019 at 16:29 | review | Suggested edits | |||
| S May 29, 2019 at 17:12 | |||||
| Feb 7, 2018 at 10:17 | history | edited | Kusalananda♦ | CC BY-SA 3.0 | Remove double "in fact" |
| Nov 27, 2014 at 23:01 | vote | accept | slm♦ | ||
| Nov 27, 2014 at 12:25 | comment | added | Stéphane Chazelas | A failing kill -0 $(pgrep sleep) may not necessarily mean your're weak, it will return false if there's no sleep command running, or if there's more than one and there's one you can't kill, or if one of the sleeps dies in between the pgrep and the kill commands being run. | |
| Nov 26, 2014 at 19:23 | comment | added | Barmar | In addition to telling you if the PID is alive, it also effectively tells you if it's still running a process from your UID, since you don't have permission to send signals to other UIDs (unless you're root). This makes false positives due to PID reuse less likely. | |
| Nov 25, 2014 at 19:24 | comment | added | Warren Young | Prateek61 is right. You can't use pgrep, ps parsing or test -e /proc/$PID in portable scrips, but kill -0 works everywhere. If you're given a PID that may be stale — e.g. a /var/run entry — this is the portable way to check if the process is still alive. | |
| Nov 25, 2014 at 19:01 | comment | added | 111--- | @slm nice find. Using this logic right now in a script i am writing, thanks. | |
| Nov 25, 2014 at 18:58 | comment | added | prateek61 | I would also add this could be used for multi-proc scripts to see if a process is still live. | |
| Nov 25, 2014 at 17:50 | history | answered | slm♦ | CC BY-SA 3.0 |