Setup a python script as a service through systemctl/systemd

There are several ways you can run your program as a background service in Linux such as crontab, .bashrc, etc but today I’ll write about systemd. I was initially looking for a way to run my python script as a background service so even if the server restarts for some reason, my script will run in the background regardless and I found that systemd allows me to do that. Let’s get started

I’ll be setting this up on an Ubuntu 18.10 machine.

Almost all versions of Linux come with systemd out of the box, but if your’s didn’t come with it then you can simply run the following command:

Click Here

Tags: Python setup