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

Beginners • Please help .. Headless program startup issue (service) still cannot find what causes auto start up to fail

$
0
0
Headless program startup issue (service) still cannot find what causes auto start up to fail

I am trying to run a departure board python3 prog by Jonathan Foot.
I have been fiddeling with this over the last weeks, tried to understand the boot.pdf Beginners Guide to running a Program at startup but am still none the wiser.
Unfortunately I don’t have access to anyone that can help me find the error.

I really hope that one of you is able to assist. It seems that it behaves fine on other models and the recommended 64bit lite (but that does not work on the zero)
The link to the project is: https://departureboard.jonathanfoot.com ... nload.html

Many thanks!
Jaap

Raspberrypi zero W running Raspberry Pi OS Lite (32-bit)

It runs perfectly when started manually (smb – putty)

In order to start it up, I enter:
In order to start it up, I enter:

Code:

sudo systemctl enable startupDisplay.servicesudo systemctl start startupDisplay.service
all good and functioning.
on

Code:

sudo reboot now
however, it will not autostart.
To create autostart, I follow these instructions:
To run the program automatically each time you plug in your pi we need to create a start up service, follow the instructions below once you have your API key and stop/station ID needed.

Code:

cd ~nano startupDisplay.sh
Once nano (text file writing program) has loaded write at the top of the new file:

Code:

#!/bin/bash source ~/Bus-Departure-Board/bin/activatepython3 ~/Bus-Departure-Board/NationalRailPy3.py -k [YOUR KEY HERE] -s [YOUR STATION ID HERE]
Press 'Ctrl' + 'x', then 'y' and 'Enter' to save the file.

Code:

chmod u+x startupDisplay.shsudo systemctl edit --force --full startupDisplay.service
enter the following in startupDisplay.service:
[Unit]
Description=Starts up the bus or rail display once pi is powered on and connected
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=display
WorkingDirectory=/home/display
ExecStart=/bin/bash /home/display/startupDisplay.sh

[Install]
WantedBy=multi-user.target


Once again save and exit the file by pressing, 'Ctrl' + 'x', then 'y' and 'Enter'.

Code:

sudo systemctl enable startupDisplay.servicesudo systemctl start startupDisplay.service
(see printscreen result from systemctl status when running)
systemctl status after reboot.jpg
the service then runs fine.
However when pulling the plug or a

Code:

sudo reboot now
and then waiting leads to nothing: the automatic starting does not work.
(see printscreen result from systemctl status after reboot)
systemctl status when running.jpg
(display shows static display from before reboot but no longer changing)
If I pull the plug and then put it back, the screen remains blank. The systemctl status result remains the same as that after a reboot.

When I run groups display GPIO is listed.

I am at a complete loss, I have found so many threads which seem to deal with this but nothing has worked for me so far.
Many thanks!

Statistics: Posted by JM98 — Wed Jul 03, 2024 12:59 pm



Viewing all articles
Browse latest Browse all 4104

Trending Articles