I'm using init.d to start a Python script on boot. The script employs hardware PWM. When I run the Python manually as the pi user, it works fine. When I start the script manually, calling the daemon from the commandline, it works fine.
At boot things are a little different. When
start-stop-daemon --user pi is called, the script runs and most features work perfecnt,y except I get no hardware PWM output. Instead, if
start-stop-daemon --user root is called, the script doesn't appear to run at all and status_of_proc reports:
● lcdtemp.service - LSB: LCD multi temperature display
Loaded: loaded (/etc/init.d/lcdtemp.sh; generated)
Active: active (exited) since Sun 2023-07-09 15:55:32 BST; 4min 29s ago
Process: 252 ExecStart=/etc/init.d/lcdtemp.sh start (code=exited, status=0/SUCCESS)
which I think means it quit for some reason, but there's no error message from my Python.
I suspect running it as user root doesn't work because root isn't in the GPIO group, and running it as pi doesn't work because we need to be root to get GPIO.
Am I up the right street? How can I figure out what's going on?