Systemd Service Guide

When creating applications that you'd like to run over a continuous period of time, you're eventually going to need to worry about timing, system integration, and startup/exit behavior, but while creating your own methods to do so I'm sure you'll learn a lot about the Linux operating system, but often times its a bit more work than one would like just to get a simple application running. For this tutorial I'm going to show you how I created a service to run my Eva Unit-01 discord bot. Eva is a python script that runs out of a virtual environment that i would like to be run on startup with any issues or output logged to the systemd journal. 

Creating the Service

So while "creating a service" sounds like a high task, its as simple as creating a text file in the /etc/systemd/system directory. So were going to sudo vim /etc/systemd/system/evabot.service My service file is going to look like this. 


Description=Thaddeus's Eva Bot





ExecStart=/home/thaddeus/EVA/bin/python3 /home/thaddeus/EVA/




Starting and enabling the service

Now that you've created your text file in the appropriate directory, youre gonna want to reaload the systemd manager config using 

sudo systemd daemon-reload  

And youre going to start and enable your service using

sudo systemctl enable evabot && sudo systemctl start evabot

of you would like to check the status of your service you can always 

sudo systemctl status evabot

And its that easy, you did it.