Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 2446

General discussion • Error Reading SYSTEMD Log File

$
0
0
Passing this on for others that may come across it. Also for others who may have other solutions. Service definition at the end.

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
ERROR:
  • Forgot error message number from Python both text and CAT both reported 'I/O Error''
SOLUTION:
  • 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



Viewing all articles
Browse latest Browse all 2446

Trending Articles