Graceful shutdown when SIGTERM is received (#2286)

Only works on Unix.
This commit is contained in:
El Laggron
2019-01-23 00:28:30 +01:00
committed by Toby Harradine
parent abcf179042
commit 3b62572c89
2 changed files with 17 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ Paste the following and replace all instances of :code:`username` with the usern
Restart=always
RestartSec=15
RestartPreventExitStatus=0
TimeoutStopSec=10
[Install]
WantedBy=multi-user.target
@@ -48,6 +49,14 @@ To set the bot to start on boot, you must enable the service, again adding the i
:code:`sudo systemctl enable red@instancename`
If you need to shutdown the bot, you can use the ``[p]shutdown`` command or
type the following command in the terminal, still by adding the instance name after the **@**:
:code:`sudo systemctl stop red@instancename`
.. warning:: If the service doesn't stop in the next 10 seconds, the process is killed.
Check your logs to know the cause of the error that prevents the shutdown.
To view Reds log, you can acccess through journalctl:
:code:`sudo journalctl -u red@instancename`