Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Daemon-Control CPAN distribution.

Report information
The Basics
Id: 87491
Status: open
Priority: 0/
Queue: Daemon-Control

People
Owner: Nobody in particular
Requestors: jul.gil [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Allow all users to test the status of the daemon
Date: Wed, 31 Jul 2013 19:47:52 +0200
To: bug-Daemon-Control [...] rt.cpan.org
From: "jul.gil [...] gmail.com" <jul.gil [...] gmail.com>
kill 0 $pid is mainly used to test if the process is running. However only the user running the daemon is able to do a kill 0. So all other users have "[Not Running]", although the daemon is running. It could be very useful to allow others to have a correct answer. As 'kill 0' just tests if a process is running with this pid, an other solution could be to test for a "/proc/$pid" directory. As proc is readable by everybody, the 'status' command could then be used by everybody. Regards, -- Julien Gilles.
On 2013-07-31 13:48:45, jgilles wrote: Show quoted text
> kill 0 $pid is mainly used to test if the process is running. However > only the user running the daemon is able to do a kill 0. So all other > users have "[Not Running]", although the daemon is running. > It could be very useful to allow others to have a correct answer. > > As 'kill 0' just tests if a process is running with this pid, an other > solution could be to test for a "/proc/$pid" directory. As proc is > readable by everybody, the 'status' command could then be used by > everybody.
The /proc filesystem is not available on every OS (for example, while FreeBSD has a procfs and linprocfs available, it's not mounted anymore by default). A portable solution could use the following (taken from perldoc perlipc): unless (kill(0 => $pid) || $!{EPERM}) { warn "$pid looks dead"; } Regards, Slaven
On 2013-07-31 13:48:45, jgilles wrote: Show quoted text
> kill 0 $pid is mainly used to test if the process is running. However > only the user running the daemon is able to do a kill 0. So all other > users have "[Not Running]", although the daemon is running. > It could be very useful to allow others to have a correct answer. > > As 'kill 0' just tests if a process is running with this pid, an other > solution could be to test for a "/proc/$pid" directory. As proc is > readable by everybody, the 'status' command could then be used by > everybody.
A fix is now available: https://github.com/symkat/Daemon-Control/pull/68