in reply to Generic Daemon Use

Do you have a "/etc/ticktockd.conf"? Could it be die-ing trying to read a non-existant file? Maybe change

open(CONFIG, "</etc/ticktockd.conf") or die;
to
open(CONFIG, "</etc/ticktockd.conf") or die "Failure opening config fi +le: $!"

non-Perl: Andy Ford

Replies are listed 'Best First'.
Re^2: Generic Daemon Use
by smist (Acolyte) on Feb 02, 2007 at 18:05 UTC
    Thanks for the reply. I do have the conf file in /etc. I'm getting no error output when using $!.

      Here's another thought: run your Daemon in the foreground:

      newdaemon( progname => 'ticktockd', pidfile => '/var/run/ticktockd.pid', configfile => '/etc/ticktockd.conf', foreground => 1, );
      If it's running in the background you may never see any output.

      non-Perl: Andy Ford

        Thanks again. Foregrounding it I see that the Generic.pm module is calling a subroutine named write_file (for writing the pid file) that doesn't exist. I'm not sure where that particular subroutine is supposed to be found but I wrote added one of my own to that module file and got the daemon to run and stay running. I'll play around some more with it. I just needed to get past this hurdle. Thanks for your help!

      Well then, I'd say it's probably time to start sprinkling print statements into your code. For instance you might do (untested)

      sub gd_preconfig { my ($self) = @_; print "opening config file\n"; open(CONFIG, "</etc/ticktockd.conf") or die "Failure opening c +onfig file:$!"; while(<CONFIG>) { $sleeptime = $1 if /^sleeptime\s+(\d+)/; } close(CONFIG); print "done reading config, sleeptime is now $sleeptime\n"; return (); }
      Oh, and I just noticed that you need to add "use strict" to the top of your program! Very important!

      non-Perl: Andy Ford