From 582ef74a61dcf7c0b061ba7261fca0706015fbd7 Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Wed, 27 Jun 2018 18:07:59 -0700 Subject: [PATCH] Restart JupyterHub after each install Restarting JupyterHub should be non-disruptive, and helps make the config changes come true ASAP. --- tljh/installer.py | 2 +- tljh/systemd.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tljh/installer.py b/tljh/installer.py index ee5efe2..a6707ca 100644 --- a/tljh/installer.py +++ b/tljh/installer.py @@ -73,4 +73,4 @@ conda.ensure_conda_packages(USER_ENV_PREFIX, [ ]) systemd.reload_daemon() systemd.start_service('configurable-http-proxy') -systemd.start_service('jupyterhub') +systemd.restart_service('jupyterhub') diff --git a/tljh/systemd.py b/tljh/systemd.py index cef33e6..1951da7 100644 --- a/tljh/systemd.py +++ b/tljh/systemd.py @@ -46,3 +46,14 @@ def start_service(name): 'start', name ], check=True) + + +def restart_service(name): + """ + Restart service with given name. + """ + subprocess.run([ + 'systemctl', + 'restart', + name + ], check=True)