diff --git a/bin/aleesa-weba b/bin/aleesa-weba index bb25eaa..ac8e14c 100755 --- a/bin/aleesa-weba +++ b/bin/aleesa-weba @@ -111,8 +111,12 @@ if (defined $logfile) { 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 my $apath = abs_path $PROGRAM_NAME; @@ -122,7 +126,6 @@ unless (defined $apath) { exit 1; }; -# write pidfile my $pidfile = sprintf '%s/%s.pid', $piddir, basename $apath; $log->info ("[INFO] Creating pidfile at $pidfile"); diff --git a/data/config_sample.json b/data/config_sample.json index 520be4e..517003d 100644 --- a/data/config_sample.json +++ b/data/config_sample.json @@ -3,6 +3,9 @@ "server" : "redis", "port" : "6379", +# should we fork() and become unix daemon? + "daemonize": 1, + # where caches go there "cachedir" : "data/cache",