Browse Source

master: Move pid-file creation after the daemonization

Creating the pid-file before daemonizing results in the pid-file containing the
pid of the process that started the daemon, but is now dead.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
Reported-By: Torkel Rogstad @torkelrogstad
ppa-0.6.1
Christian Decker 7 years ago
parent
commit
a41ab650e5
  1. 6
      lightningd/lightningd.c

6
lightningd/lightningd.c

@ -290,9 +290,6 @@ int main(int argc, char *argv[])
/* Handle options and config; move to .lightningd */
newdir = handle_opts(ld, argc, argv);
/* Create PID file */
pidfile_create(ld);
/* Ignore SIGPIPE: we look at our write return values*/
signal(SIGPIPE, SIG_IGN);
@ -373,6 +370,9 @@ int main(int argc, char *argv[])
if (ld->daemon)
daemonize_but_keep_dir(ld);
/* Create PID file */
pidfile_create(ld);
/* Mark ourselves live. */
log_info(ld->log, "Server started with public key %s, alias %s (color #%s) and lightningd %s",
type_to_string(tmpctx, struct pubkey, &ld->id),

Loading…
Cancel
Save