Jimmy062006/Opux

Wiki: third number for linux to start (using systemd)

MyUncleSam opened this issue · 0 comments

If you want you can add my systemd solution to your wiki for linux installations (at the most bottom):


Number 3:

Using systemd your are not able to run the bot using 'dotnet run'. So you have to generate a start and stop function (if you host multiple bots be sure the "opuxbot" in all scripts match exactly one bot and not multiple bots!):

Start (be sure to insert both lines!):

#!/bin/sh -
/usr/bin/screen -A -m -d -S opuxbot bash -c 'while true ; do /usr/bin/dotnet run --project /path/to/your/bot/folder/Opux/src/Opux/Opux.csproj -- ; done'

Stop (be sure to insert both lines!):

#!/bin/sh -
/usr/bin/screen -X -S opuxbot quit

SystemD part:

[Unit]
Description=OpuxBot
After=network.target

[Service]
WorkingDirectory=/path/to/your/bot/folder
ExecStart=/path/to/the/start.sh
ExecStop=/path/to/the/stop.sh
Type=oneshot
User=username_to_run_under
#Group=groupname_to_run_under_optional
RemainAfterExit=yes

[Install]
WantedBy=graphical.target