diff options
| author | Paul Buetow <paul@buetow.org> | 2011-05-24 06:59:48 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2011-05-24 06:59:48 +0000 |
| commit | 62db99d2b1297888d984118d0679a289024e2b8e (patch) | |
| tree | 36ae6262feff735b169d6144b880a8c1686a5bc8 /lib/PerlDaemon/PerlDaemon.pl | |
| parent | 956310f1b221bbbc612a6efd04f260d503e631ce (diff) | |
added daemon.daemonize option (daemon can now start in the foreground if wished)
Diffstat (limited to 'lib/PerlDaemon/PerlDaemon.pl')
| -rw-r--r-- | lib/PerlDaemon/PerlDaemon.pl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/PerlDaemon/PerlDaemon.pl b/lib/PerlDaemon/PerlDaemon.pl index 3e3038b..1bee431 100644 --- a/lib/PerlDaemon/PerlDaemon.pl +++ b/lib/PerlDaemon/PerlDaemon.pl @@ -83,7 +83,7 @@ sub readconf ($) { # Check my $msg = 'Missing property:'; - foreach (qw(wd loopinterval alivefile pidfile logfile)) { + foreach (qw(wd loopinterval alivefile pidfile logfile daemonize)) { my $key = "daemon.$_"; die "$msg $key\n" unless exists $conf{$key}; } @@ -157,7 +157,13 @@ my $conf = readconf shift; $conf->{logger} = PerlDaemon::Logger->new($conf); prestartup $conf; -daemonize $conf; + +if ($conf->{'daemon.daemonize'} ne 'yes') { + print "Running in foreground...\n"; +} else { + daemonize $conf; +} + sighandlers $conf; daemonloop $conf; |
