diff options
author | sohamg <sohamg2@gmail.com> | 2019-06-10 17:31:56 +0530 |
---|---|---|
committer | sohamg <sohamg2@gmail.com> | 2019-06-10 17:41:48 +0530 |
commit | ab157e61a27c48b5f90a0c9168d534d760c0c80c (patch) | |
tree | 9c26b0fa8ba5648e38764571b5fd685864fd0a46 | |
parent | 0.99.5.2 (diff) | |
download | synapse-ab157e61a27c48b5f90a0c9168d534d760c0c80c.tar.xz |
- Fix https://github.com/matrix-org/synapse/issues/4130
- Add parser argument "--no-daemonize" Signed-off-by: sohamg <sohamg2@gmail.com>
-rwxr-xr-x | synctl | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/synctl b/synctl index 07a68e6d85..601ca41fc3 100755 --- a/synctl +++ b/synctl @@ -69,10 +69,14 @@ def abort(message, colour=RED, stream=sys.stderr): sys.exit(1) -def start(configfile): +def start(configfile, daemonize = True): write("Starting ...") args = SYNAPSE - args.extend(["--daemonize", "-c", configfile]) + + if daemonize: + args.extend(["--daemonize", "-c", configfile]) + else: + args.extend(["-c", configfile]) try: subprocess.check_call(args) @@ -143,12 +147,20 @@ def main(): help="start or stop all the workers in the given directory" " and the main synapse process", ) + parser.add_argument( + "--no-daemonize", + action="store_false", + help="Run synapse in the foreground (for debugging)" + ) options = parser.parse_args() if options.worker and options.all_processes: write('Cannot use "--worker" with "--all-processes"', stream=sys.stderr) sys.exit(1) + if options.no_daemonize and options.all_processes: + write('Cannot use "--no-daemonize" with "--all-processes"', stream=sys.stderr) + sys.exit(1) configfile = options.configfile @@ -276,7 +288,7 @@ def main(): # Check if synapse is already running if os.path.exists(pidfile) and pid_running(int(open(pidfile).read())): abort("synapse.app.homeserver already running") - start(configfile) + start(configfile, bool(options.no_daemonize)) for worker in workers: env = os.environ.copy() |