From 5de65a74b5c0b8d3c310482954e1851a6fb31a2a Mon Sep 17 00:00:00 2001 From: palmtree5 <3577255+palmtree5@users.noreply.github.com> Date: Thu, 15 Apr 2021 16:58:22 -0800 Subject: [PATCH] Mac autostart docs (#4082) * Mac autostart * Make requested changes to these instructions * Add a note about how to view the logs --- docs/autostart_mac.rst | 86 ++++++++++++++++++++++++++++++++++++++++++ docs/index.rst | 1 + 2 files changed, 87 insertions(+) create mode 100644 docs/autostart_mac.rst diff --git a/docs/autostart_mac.rst b/docs/autostart_mac.rst new file mode 100644 index 000000000..f8207a8eb --- /dev/null +++ b/docs/autostart_mac.rst @@ -0,0 +1,86 @@ +.. launchd guide + +============================== +Setting up auto-restart on Mac +============================== + +----------------------- +Creating the plist file +----------------------- + +Start by activating your venv. Then run the following command: + +.. code-block:: none + + which python + +Copy the output of that command. + +Now run :code:`sudo nano /Library/LaunchDaemons/red.plist` + +Paste the following and replace the following: + +- all instances of :code:`username` with your Mac username +- :code:`path` with the path you copied earlier +- :code:`instance-name` with your instance name: + +.. code-block:: none + + + + + + Label + red + ProgramArguments + + path + -O + -m + redbot + instance-name + --no-prompt + + RunAtLoad + + KeepAlive + + SuccessfulExit + + + StandardOutPath + /tmp/red_out.log + StandardErrorPath + /tmp/red_err.log + UserName + username + InitGroups + + + + +.. note:: + + You may add any additional arguments you need to add to the :code:`redbot` command by + adding them to the end of the array under :code:`ProgramArguments` + +.. note:: + + Should you need to view the output from Red (for example: to find error messages that + are output to the console to help with support), you can run :code:`nano /tmp/red_out.log` + and :code:`nano /tmp/red_err.log` to do so + +Save and exit :code:`ctrl + O; enter; ctrl + x` + +----------------- +Loading the plist +----------------- + +Run the following: + +:code:`sudo launchctl load /Library/LaunchDaemons/red.plist` + +If you need to shutdown the bot, you can use the ``[p]shutdown`` command or +type the following command in the terminal: + +:code:`sudo launchctl stop red` \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 7872afa9d..97e41ef76 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -18,6 +18,7 @@ Welcome to Red - Discord Bot's documentation! update_red about_venv autostart_systemd + autostart_mac autostart_pm2 .. toctree::