1

In a prod environment, I want to run some python scripts that run on start-up and never stop. Currently I am trying to run them as daemon processes, i.e. something like this in systemd:

#!/bin/bash
python3 a.py&
python3 b.py&
python3 c.py&
...

Is this a sustainable/ correct way of implementing something I need? Also, these scripts are subject to change in the future. There is also the option of splitting them into smaller parts that don't require changing in the future, but that would increase the number of python scripts within the bash script in systemd. (Imagine pulling data from various sources, and the sources would keep increasing in the future.) Would it be a good option to just add a new script to the list and do a start service every time something new is needed?

Thanks a lot!

1

I would look at creating systemd unit files for each daemon so that it can be controlled separately from all the others. Whilst doing that I would ensure that the unit files allowed each daemon to be restarted. This way I can deploy a change with my config management tools and have them automatically restart the relevant daemon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.