Make daemonize optional
This commit is contained in:
@@ -111,8 +111,12 @@ if (defined $logfile) {
|
|||||||
Log::Any::Adapter->set ('File', '/dev/null');
|
Log::Any::Adapter->set ('File', '/dev/null');
|
||||||
}
|
}
|
||||||
|
|
||||||
# double fork attach to /dev/null all stdio and go background
|
# по-умолчанию, демонизируемся, если явно не указано, что этого делать не надо
|
||||||
#daemonize ();
|
if (defined ($c->{daemonize}) && $c->{daemonize}) {
|
||||||
|
daemonize ();
|
||||||
|
} elsif ( ! defined ($c->{daemonize})) {
|
||||||
|
daemonize ();
|
||||||
|
}
|
||||||
|
|
||||||
# write pidfile
|
# write pidfile
|
||||||
my $apath = abs_path $PROGRAM_NAME;
|
my $apath = abs_path $PROGRAM_NAME;
|
||||||
@@ -122,7 +126,6 @@ unless (defined $apath) {
|
|||||||
exit 1;
|
exit 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
# write pidfile
|
|
||||||
my $pidfile = sprintf '%s/%s.pid', $piddir, basename $apath;
|
my $pidfile = sprintf '%s/%s.pid', $piddir, basename $apath;
|
||||||
$log->info ("[INFO] Creating pidfile at $pidfile");
|
$log->info ("[INFO] Creating pidfile at $pidfile");
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
"server" : "redis",
|
"server" : "redis",
|
||||||
"port" : "6379",
|
"port" : "6379",
|
||||||
|
|
||||||
|
# should we fork() and become unix daemon?
|
||||||
|
"daemonize": 1,
|
||||||
|
|
||||||
# where caches go there
|
# where caches go there
|
||||||
"cachedir" : "data/cache",
|
"cachedir" : "data/cache",
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user