0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-15 06:23:52 +01:00

Merge pull request #5587 from matrix-org/erikj/fix_synctl

Fix --no-daemonize flag for synctl
This commit is contained in:
Erik Johnston 2019-07-02 11:17:55 +01:00 committed by GitHub
commit c3863ad6bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

1
changelog.d/5587.feature Normal file
View file

@ -0,0 +1 @@
Add --no-daemonize option to run synapse in the foreground, per issue #4130. Contributed by Soham Gumaste.

12
synctl
View file

@ -150,8 +150,9 @@ def main():
parser.add_argument( parser.add_argument(
"--no-daemonize", "--no-daemonize",
action="store_false", action="store_false",
dest="daemonize",
help="Run synapse in the foreground for debugging. " help="Run synapse in the foreground for debugging. "
"Will work only if the daemonize option is not set in the config." "Will work only if the daemonize option is not set in the config.",
) )
options = parser.parse_args() options = parser.parse_args()
@ -159,7 +160,7 @@ def main():
if options.worker and options.all_processes: if options.worker and options.all_processes:
write('Cannot use "--worker" with "--all-processes"', stream=sys.stderr) write('Cannot use "--worker" with "--all-processes"', stream=sys.stderr)
sys.exit(1) sys.exit(1)
if options.no_daemonize and options.all_processes: if not options.daemonize and options.all_processes:
write('Cannot use "--no-daemonize" with "--all-processes"', stream=sys.stderr) write('Cannot use "--no-daemonize" with "--all-processes"', stream=sys.stderr)
sys.exit(1) sys.exit(1)
@ -169,9 +170,8 @@ def main():
write( write(
"No config file found\n" "No config file found\n"
"To generate a config file, run '%s -c %s --generate-config" "To generate a config file, run '%s -c %s --generate-config"
" --server-name=<server name> --report-stats=<yes/no>'\n" % ( " --server-name=<server name> --report-stats=<yes/no>'\n"
" ".join(SYNAPSE), options.configfile, % (" ".join(SYNAPSE), options.configfile),
),
stream=sys.stderr, stream=sys.stderr,
) )
sys.exit(1) sys.exit(1)
@ -289,7 +289,7 @@ def main():
# Check if synapse is already running # Check if synapse is already running
if os.path.exists(pidfile) and pid_running(int(open(pidfile).read())): if os.path.exists(pidfile) and pid_running(int(open(pidfile).read())):
abort("synapse.app.homeserver already running") abort("synapse.app.homeserver already running")
start(configfile, bool(options.no_daemonize)) start(configfile, bool(options.daemonize))
for worker in workers: for worker in workers:
env = os.environ.copy() env = os.environ.copy()