Skip to content

Instantly share code, notes, and snippets.

View snikitin-de's full-sized avatar

Sergey Nikitin snikitin-de

View GitHub Profile
@snikitin-de
snikitin-de / python_systemd.md
Created September 8, 2021 15:43 — forked from ilyasst/python_systemd.md
Run a python script forever using systemd

Run a python script forever

In this section, we are going to show how to run a python script as a systemd service, allowing you to boot it at the start of a Linux machine and to maintain it alive.

Test method: Telegram Bot

We are going to use a very basic Telegram bot in order to test that our script will:

  1. Automatically start when the machine boot
  2. Automatically restart when it crashes/exits for whichever reason