Let’s say you wish to have a process running in the background on Linux. You can define a service and run it using Systemd

1. Create a .service file

[Unit]
Description=My test service
After=multi-user.target
[Service]
Type=simple
Restart=always
ExecStart=path_to_python script.py
[Install]
WantedBy=multi-user.target

2. Copy this file to /etc/systemd/system

3. Enable the servicesudo systemctl enable xfly_scheduler.service

4. Start the service sudo systemctl start xfly_scheduler.service

5. To see logs sudo journalctl -u xfly_scheduler.service