in reply to Test if Daemon::Control daemon is running.
The following (quick & dirty) works fine for me, when run from the same user account (note each of these actually starts with shebang and use warnings; use strict;):
# -- prog.pl -- my $run = 1; $SIG{TERM} = sub { $run=0 }; while($run) { sleep 1; `touch /tmp/foo` } `rm -f /tmp/foo`; # -- daem.pl -- use Daemon::Control; exit Daemon::Control->new( name => 'foobar', program => '/tmp/prog.pl', pid_file => '/tmp/prog.pid', )->run; # -- app.pl -- use Daemon::Control; my $stat = Daemon::Control->new( name => 'foobar', program => '/tmp/prog.pl', pid_file => '/tmp/prog.pid', quiet => 1, )->do_status; print "Status: $stat\n";
It does not work if I don't define the pid_file or if I run app.pl as a different user (apparently due to the bug referenced above). So maybe one of those two things are the cause for your trouble? If it still doesn't work for you, could you show some code to reproduce?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Test if Daemon::Control daemon is running.
by gh (Initiate) on Feb 07, 2015 at 21:47 UTC |