diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index f5e22a533..d671cf712 100644 --- a/lightningd/lightningd.c +++ b/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),