Hi I am trying to configure both systemd service and timer files to run a shell script (capturing footage) both on boot and at the start of every subsequent hour.
The service and shell script run as intended on the hour but only runs on boot if the service has not been trigger in the current hour (I believe due to Persistent=True).
While this is mostly what I need, if I reboot (expectedly or not) after this initial on boot start, the service doesn't start again until the next hour start; as I need to be capturing cam footage constantly this is not ideal.
Would really appreciate some help seeing what I am missing but also opinions on whether moving to using a service which would restart once the script finished executing (script handles filming length itself) with Restart=on-failure
changed to Restart=always
being a better solution?
I am only enabling the timer file with: sudo systemctl enable start_capture.timer
.service file:
[Unit]
Description=executes camera capture script
StartLimitIntervalSec=0
[Service]
Type=simple
ExecStart=/usr/bin/bash path/start_capture.sh
Restart=on-failure
RestartSec=2
.timer file:
[Unit]
Description=schedules video capture service
After=multi-user.target
[Timer]
OnCalendar=hourly
Persistent=True
Unit=start_capture.service
[Install]
WantedBy=timers.target
Edit: I am running this on 64-bit Bullseye on a model 3b but maybe using final code on model 4.