mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 18:06:08 -05:00
[V3 Docs] Systemd guide + extras (#1505)
* Documentation extras Added links to each distro's user add functions Added systemd service guide Added --user operator to pip install commands * Update autostart_systemd.rst Added no-prompt flag
This commit is contained in:
committed by
Kowlin
parent
017c8a6900
commit
fe0b6aaba4
48
docs/autostart_systemd.rst
Normal file
48
docs/autostart_systemd.rst
Normal file
@@ -0,0 +1,48 @@
|
||||
.. systemd service guide
|
||||
|
||||
==========================
|
||||
Setting up auto-restart using systemd on Linux
|
||||
==========================
|
||||
|
||||
---------------------------
|
||||
Creating the service file
|
||||
---------------------------
|
||||
|
||||
Create the new service file:
|
||||
|
||||
:code:`sudo nano /etc/systemd/system/red@.service`
|
||||
|
||||
Paste the following and replace all instances of :code:`username` with the username your bot is running under (hopefully not root):
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
[Unit]
|
||||
Description=%I redbot
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/home/username/.local/bin/redbot %I --no-prompt
|
||||
User=username
|
||||
Group=username
|
||||
Type=idle
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Save and exit :code:`ctrl + O; enter; ctrl + x`
|
||||
|
||||
---------------------------
|
||||
Starting and enabling the service
|
||||
---------------------------
|
||||
|
||||
To start the bot, run the service and add the instance name after the **@**:
|
||||
|
||||
:code:`sudo systemctl start red@instancename`
|
||||
|
||||
To set the bot to start on boot, you must enable the service, again adding the instance name after the **@**:
|
||||
|
||||
:code:`sudo systemctl enable red@instancename`
|
||||
|
||||
.. note:: This same file can be used to start as many instances of the bot as you wish, without creating more service files, just start and enable more services and add any bot instance name after the **@**
|
||||
Reference in New Issue
Block a user