Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ronaldlangeveld/c3e87f94b97afc66096a40e9440df44c to your computer and use it in GitHub Desktop.
Save ronaldlangeveld/c3e87f94b97afc66096a40e9440df44c to your computer and use it in GitHub Desktop.
How to add your Python bot as a startup service on your Ubuntu Server
[Unit]
Description=bot
After=network.target
[Service]
User=username
Type=idle
ExecStart=/home/user/bots/venv/bin/python3.6 /home/user/bots/botscript.py
[Install]
WantedBy=multi-user.target
add this file (change the directory to your virtualenv and bot script - also the user) to /etc/systemd/system/
save it as botname.service
start it by running
sudo systemctl start botname
sudo systemctl enable botname
sudo systemctl status botname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment