Skip to content

Instantly share code, notes, and snippets.

@ilyasst
ilyasst / python_systemd.md
Last active April 15, 2024 04:34
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

Run freqtrade on your VM


Important

TA-lib requires 2Gb of RAM. You can either:

  1. Upgrade your VM to a 2Gb RAM VM
  2. Use this guide to create a SWAP file (virtual memory) on the VM's SSD that is at least 2Gb: https://www.vultr.com/docs/setup-swap-file-on-linux