Setup a python script as a service through systemctl/systemd

<p>There are several ways you can run your program as a background service in Linux such as&nbsp;<strong>crontab, .bashrc,&nbsp;</strong>etc but today I&rsquo;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&rsquo;s get started</p> <p>I&rsquo;ll be setting this up on an&nbsp;<strong>Ubuntu 18.10&nbsp;</strong>machine.</p> <p>Almost all versions of Linux come with&nbsp;<strong>systemd</strong>&nbsp;out of the box, but if your&rsquo;s didn&rsquo;t come with it then you can simply run the following command:</p> <p><a href="https://medium.com/codex/setup-a-python-script-as-a-service-through-systemctl-systemd-f0cc55a42267"><strong>Click Here</strong></a></p>
Tags: setup Python