Python library to deamonize any process, is made available on the unixutils github page. This can be used as a base to create systemd services on Linux on the fly.

Steps to Create your own systemd service
- clone the directory from github and copy the bin & lib directories to a location from where you’d want to run the service.
- Create a systemd unit file similar to the one provided in systemd directory. The systemd unit file should be updated with correct path to where the script is located.
- Update here in your script with what you’d like to run, when the service is started. This can be a python function that you’d like to call or it can be an as simple as an OS call to an external command. Example: os.system(“/bin/bash /path/to/some/command/or/script”). That is all!. You can start and enable the systemd services.