summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-06-10 15:09:49 +0100
committerGitHub <noreply@github.com>2019-06-10 15:09:49 +0100
commit6d1e699b5c181542c686affd84ef81ea9649550a (patch)
tree9b11f171eb56d3545e06d257aa33ff484f14a103
parentMerge pull request #5325 from matrix-org/babolivier/port_db_account_validity (diff)
parentAccidentally reversed pep8 fixed before, fixed now (diff)
downloadsynapse-6d1e699b5c181542c686affd84ef81ea9649550a.tar.xz
Merge pull request #5412 from SohamG/fix-4130
Add --no-daemonize option to synctl
-rw-r--r--changelog.d/5412.feature1
-rwxr-xr-xsynctl19
2 files changed, 17 insertions, 3 deletions
diff --git a/changelog.d/5412.feature b/changelog.d/5412.feature
new file mode 100644

index 0000000000..ec1503860a --- /dev/null +++ b/changelog.d/5412.feature
@@ -0,0 +1 @@ +Add --no-daemonize option to run synapse in the foreground, per issue #4130. Contributed by Soham Gumaste. \ No newline at end of file diff --git a/synctl b/synctl
index 07a68e6d85..30d751236f 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,21 @@ 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. " + "Will work only if the daemonize option is not set in the config." + ) 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 +289,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()