diff --git a/class/core/common.py b/class/core/common.py index eec893a88..8ac3a7e47 100755 --- a/class/core/common.py +++ b/class/core/common.py @@ -67,6 +67,8 @@ def initInitD(): systemd_mw_tpl = mw.getRunDir() + '/scripts/init.d/mw.service.tpl' systemd_mw_task_tpl = mw.getRunDir() + '/scripts/init.d/mw-task.service.tpl' + os.remove(systemd_mw) + os.remove(systemd_mw_task) doContentReplace(systemd_mw_tpl, systemd_mw) doContentReplace(systemd_mw_task_tpl, systemd_mw_task) diff --git a/scripts/init.d/mw-task.service.tpl b/scripts/init.d/mw-task.service.tpl index 76da148a5..f066bacaf 100755 --- a/scripts/init.d/mw-task.service.tpl +++ b/scripts/init.d/mw-task.service.tpl @@ -3,8 +3,9 @@ Description=mw-task server daemon After=network.target [Service] -Type=forking -ExecStart=cd {$SERVER_PATH} && python3 task.py +Type=simple +WorkingDirectory={$SERVER_PATH} +ExecStart=python3 task.py ExecStop=kill -HUP $MAINID ExecReload=kill -HUP $MAINID KillMode=process diff --git a/scripts/init.d/mw.service.tpl b/scripts/init.d/mw.service.tpl index e19baf38e..0fed4bf84 100755 --- a/scripts/init.d/mw.service.tpl +++ b/scripts/init.d/mw.service.tpl @@ -3,8 +3,9 @@ Description=mw server daemon After=network.target [Service] -Type=forking -ExecStart=cd {$SERVER_PATH} && gunicorn -c setting.py app:app +Type=simple +WorkingDirectory={$SERVER_PATH} +ExecStart=gunicorn -c setting.py app:app ExecStop=kill -HUP $MAINID ExecReload=kill -HUP $MAINID KillMode=process