Put the pidfile in the right place

Seems we relied on the chdir for that to happen, previously.
This commit is contained in:
Jean-Paul Calderone 2020-12-17 09:37:45 -05:00
parent 70305131f1
commit 6e152daf05

View File

@ -202,7 +202,9 @@ def run(config, runApp=twistd.runApp):
if not nodetype:
print("%s is not a recognizable node directory" % quoted_basedir, file=err)
return 1
twistd_args = ["--nodaemon", "--rundir", basedir]
pidfile = get_pidfile(basedir)
twistd_args = ["--nodaemon", "--rundir", basedir, "--pidfile", pidfile]
twistd_args.extend(config.twistd_args)
twistd_args.append("DaemonizeTahoeNode") # point at our DaemonizeTahoeNodePlugin
@ -219,7 +221,6 @@ def run(config, runApp=twistd.runApp):
twistd_config.loadedPlugins = {"DaemonizeTahoeNode": DaemonizeTahoeNodePlugin(nodetype, basedir)}
# handle invalid PID file (twistd might not start otherwise)
pidfile = get_pidfile(basedir)
if get_pid_from_pidfile(pidfile) == -1:
print("found invalid PID file in %s - deleting it" % basedir, file=err)
os.remove(pidfile)