smist has asked for the wisdom of the Perl Monks concerning the following question:
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"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Generic Daemon Use
by andyford (Curate) on Feb 02, 2007 at 16:34 UTC | |
by smist (Acolyte) on Feb 02, 2007 at 18:05 UTC | |
by andyford (Curate) on Feb 02, 2007 at 18:20 UTC | |
by smist (Acolyte) on Feb 02, 2007 at 18:41 UTC | |
by dirving (Friar) on Feb 03, 2007 at 02:53 UTC | |
by andyford (Curate) on Feb 02, 2007 at 18:54 UTC | |
by andyford (Curate) on Feb 02, 2007 at 18:14 UTC | |
|
Re: Generic Daemon Use
by Zaxo (Archbishop) on Feb 03, 2007 at 01:21 UTC | |
|
Re: Generic Daemon Use
by Khen1950fx (Canon) on Feb 03, 2007 at 09:02 UTC | |
by f00li5h (Chaplain) on Feb 03, 2007 at 13:54 UTC |