Run python3 program at raspberry pi boot up

wallis

New Member
Joined
May 15, 2024
Messages
10
Reaction score
3
Credits
120
I have a python 3 program I want to start running when the raspberry pi boots up

I can enter sudo python 3 pythonclock.py and the program runs as expected.

I created a a file name runclock.sh in the /home/walli directory
the contents of runclock.sh are:
#!/bin/sh
cd /
cd /home/walli
sudo python3 pythonclock.py

I can type bash runclock.sh and the program starts and runs as expected

I used nano to edit the /etc/rc.local file and added the line: /home/walli/runclock.sh &
(the above line was added above the exit 0 line that was already in rc.local)

When I re-boot the Raspberry Pi, the program ythonclock.py does not start.

Any help would be much appreciated
 

Staff online


Top