I'm trying to use the generic daemon from:
Generic Daemon CPAN
I'm starting with trying the example from the module. I cannot get the daemon to run. I get no error messages; just a message saying the daemon is starting. When I run the "check" subroutine it says that the config is fine and the daemon is not running. Here is the code I'm trying to get working. Does someone have a working example of this? Thanks!
#!/usr/bin/perl use warnings; use Daemon::Generic; my $sleeptime = 1; newdaemon( progname => 'ticktockd', pidfile => '/var/run/ticktockd.pid', configfile => '/etc/ticktockd.conf', ); sub gd_preconfig { my ($self) = @_; open(CONFIG, "</etc/ticktockd.conf") or die; while(<CONFIG>) { $sleeptime = $1 if /^sleeptime\s+(\d+)/; } close(CONFIG); return (); } sub gd_run { while(1) { sleep($sleeptime); print scalar(localtime(time))."\n"; } }
In reply to Generic Daemon Use by smist
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |