Skip to content

Instantly share code, notes, and snippets.

@truemedian
Last active July 12, 2021 19:52
Show Gist options
  • Save truemedian/60417133036bfec016f92edc48a5c8dc to your computer and use it in GitHub Desktop.
Save truemedian/60417133036bfec016f92edc48a5c8dc to your computer and use it in GitHub Desktop.
Systemd Service: Discordia

Systemd Service: Discordia

This is an example, expect no assistance with operation.

This file should go into /lib/systemd/system

Assumptions

  1. You will need to replace init.lua with the name of your bot's entrypoint file (maybe main.lua or bot.lua).

  2. You will need to replace /some/random/path with the full directory of your discord bot.

    • You can find this by changing into the directory and running pwd.
  3. You will need to have luvit installed into /usr/local/bin.

  4. You will need to have all lit dependencies downloaded. This script will only run luvit.

Installing Luvit

curl -L https://github.com/luvit/lit/raw/master/get-lit.sh | sh && sudo mv luvit luvi lit /usr/local/bin
[Unit]
Description=Some Random Discord Bot
Requires=network-online.target
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/local/bin/luvit init.lua
WorkingDirectory=/some/random/path
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment