App-Daemon
view release on metacpan or search on metacpan
use POSIX;
$App::Daemon::kill_sig = SIGINT;
Note that his requires the numerial value (SIGINT via POSIX.pm), not a
string like "SIGINT".
=item status
will print out diagnostics on what the status of the daemon is. Typically,
the output looks like this:
Pid file: ./tt.pid
Pid in file: 15562
Running: yes
Name match: 1
/usr/local/bin/perl -w test.pl
This indicates that the pidfile says that the daemon has PID 15562 and
that a process with this PID is actually running at this moment. Also,
a name grep on the process name in the process table results in 1 match,
according to the output above.
Note that the name match is unreliable, as it just looks for a command line
that looks approximately like the script itself. So if the script is
C<test.pl>, it will match lines like "perl -w test.pl" or
"perl test.pl start", but unfortunately also lines like
"vi test.pl".
If the process is no longer running, the status output might look like
this instead:
Pid file: ./tt.pid
Pid in file: 14914
Running: no
SIGINT), set
use POSIX;
$App::Daemon::kill_sig = SIGINT;
Note that his requires the numerial value (SIGINT via POSIX.pm), not
a string like "SIGINT".
status
will print out diagnostics on what the status of the daemon is.
Typically, the output looks like this:
Pid file: ./tt.pid
Pid in file: 15562
Running: yes
Name match: 1
/usr/local/bin/perl -w test.pl
This indicates that the pidfile says that the daemon has PID 15562
and that a process with this PID is actually running at this moment.
Also, a name grep on the process name in the process table results
in 1 match, according to the output above.
Note that the name match is unreliable, as it just looks for a
command line that looks approximately like the script itself. So if
the script is "test.pl", it will match lines like "perl -w test.pl"
or "perl test.pl start", but unfortunately also lines like "vi
test.pl".
If the process is no longer running, the status output might look
like this instead:
Pid file: ./tt.pid
Pid in file: 14914
Running: no
( run in 0.715 second using v1.01-cache-2.11-cpan-64827b87656 )