With systemd this became trivially easy, as the
.service unit files in
/etc/systemd/system/ offer an easy way. Here is a minimal example without watchdog- or soft-fail-capabilities:
Description=An GPIO interrupt listener for a debounced button press to trigger an action.
ExecStartPre=/bin/bash -c 'source /opt/helotism/powersupply-env/bin/activate;'
ExecStart=/bin/bash -c 'cd /opt/helotism/powersupply-env; source bin/activate; python ./mraa_interrupt.py'
The above unit file enters a Python virtual environment that was previously deployed there. It is executed the multi-user.target has been reached. The script runs continously in a
while True: loop, reflected by