Passing this on for others that may come across it. Also for others who may have other solutions. Service definition at the end.
SYMPTOM:
SYMPTOM:
- The log file (/media/work/log/srv_reboot_button.log ) created by the service returns an error when being accessed by Python or CAT.
- The file shows allocated space
- File owned by ROOT even though service run under PI
- File is on an external USB formatted EXT4
- Python program runs ok using the 'ExecStart' line outside of SYSTEMD
- Forgot error message number from Python both text and CAT both reported 'I/O Error''
- Stop the service; delete the log file; restart the service
Code:
[Unit]Description=Reboot Button ServiceAfter=systemd-time-wait-sync.serviceWants=systemd-time-wait-sync.service[Service]Type=idleUser=piExecStart=/usr/bin/python3 -u /media/work/bin/button_action.pyc --shutdownWorkingDirectory=/media/workStandardOutput=append:/media/work/log/srv_reboot_button.log StandardError=append:/media/work/log/srv_reboot_button.logRestart=no[Install]WantedBy=multi-user.target
Statistics: Posted by DS256 — Thu May 23, 2024 12:31 pm