diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index b47d2b9f7..7a4ea87ef 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -672,10 +672,6 @@ int main(int argc, char *argv[]) * say --daemonize. */ handle_early_opts(ld, argc, argv); - /*~ Now create the PID file: this errors out if there's already a - * daemon running, so we call before doing almost anything else. */ - pidfile_create(ld); - /*~ Initialize all the plugins we just registered, so they can * do their thing and tell us about themselves (including * options registration). */ @@ -684,6 +680,10 @@ int main(int argc, char *argv[]) /*~ Handle options and config; move to .lightningd (--lightning-dir) */ handle_opts(ld, argc, argv); + /*~ Now create the PID file: this errors out if there's already a + * daemon running, so we call before doing almost anything else. */ + pidfile_create(ld); + /*~ Make sure we can reach the subdaemons, and versions match. */ test_subdaemons(ld);