Use sphinx-prompt extension (#4908)

* Use sphinx-prompt extension

* Update PM2 guide

* Use an actual proper way to run Red with PM2

* Fix pm2 docs

Co-authored-by: Kowlin <Kowlin@users.noreply.github.com>
This commit is contained in:
jack1142
2021-04-03 18:52:11 +02:00
committed by GitHub
parent 0144cbf88b
commit 0becf70b05
8 changed files with 116 additions and 80 deletions

View File

@@ -14,21 +14,23 @@ In order to create the service file, you will first need to know two things, you
First, your Linux :code:`username` can be fetched with the following command:
.. code-block:: bash
.. prompt:: bash
whoami
Next, your python :code:`path` can be fetched with the following commands:
.. code-block:: bash
.. prompt:: bash
:prompts: $,(redenv) $
:modifiers: auto
# If redbot is installed in a venv
source ~/redenv/bin/activate
which python
$ source ~/redenv/bin/activate
(redenv) $ which python
# If redbot is installed in a pyenv virtualenv
pyenv shell <virtualenv_name>
pyenv which python
$ pyenv shell <virtualenv_name>
(redenv) $ pyenv which python
Then create the new service file:
@@ -67,20 +69,28 @@ 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`
.. prompt:: bash
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`
.. prompt:: bash
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`
.. prompt:: bash
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 -eu red@instancename`
.. prompt:: bash
sudo journalctl -eu red@instancename