Only write the PID file if daemonized
There's not much point in writing a PID file if the user does not want to fork. (The process executing ddclient already knows the PID, so it can save it to a file if desired.) This change is a prerequisite to using Proc::Daemon to fix the buggy daemonization logic.
This commit is contained in:
parent
dc37e00d9d
commit
b094c1bff5
1 changed files with 1 additions and 5 deletions
6
ddclient
6
ddclient
|
@ -742,7 +742,7 @@ my @opt = (
|
||||||
[ "protocol", "=s", "-protocol type : update protocol used" ],
|
[ "protocol", "=s", "-protocol type : update protocol used" ],
|
||||||
[ "file", "=s", "-file path : load configuration information from 'path'" ],
|
[ "file", "=s", "-file path : load configuration information from 'path'" ],
|
||||||
[ "cache", "=s", "-cache path : record address used in 'path'" ],
|
[ "cache", "=s", "-cache path : record address used in 'path'" ],
|
||||||
[ "pid", "=s", "-pid path : record process id in 'path'" ],
|
[ "pid", "=s", "-pid path : record process id in 'path' if daemonized" ],
|
||||||
"",
|
"",
|
||||||
[ "use", "=s", "-use which : how the should IP address be obtained." ],
|
[ "use", "=s", "-use which : how the should IP address be obtained." ],
|
||||||
&ip_strategies_usage(),
|
&ip_strategies_usage(),
|
||||||
|
@ -839,10 +839,6 @@ if (opt('foreground')) {
|
||||||
open(STDOUT, ">/dev/null");
|
open(STDOUT, ">/dev/null");
|
||||||
open(STDERR, ">/dev/null");
|
open(STDERR, ">/dev/null");
|
||||||
open(STDIN, "</dev/null");
|
open(STDIN, "</dev/null");
|
||||||
}
|
|
||||||
|
|
||||||
# write out the pid file if we're daemon'ized
|
|
||||||
if (opt('daemon')) {
|
|
||||||
write_pid();
|
write_pid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue