Created
January 4, 2018 18:39
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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