Lukali
Lukali

Reputation: 343

Can't make python program run at boot with rc.local?

I tried to put the following before exit 0 in rc.local:

/FolderToThePyFile/piProgram.py &

The piProgram.py should start a local server, for a web-application. I tried to go to the browser to open the web-app, but the usual web-address doesn't work. Running the .py file only starts the server, it doesn't prompt for any user input. When I put in 'jobs' I don't see it running.

What am I doing wrong, and is there any way to fix it?

I am running Rasbian Os on Raspberry Pi 3 model B+.

Upvotes: 0

Views: 143

Answers (1)

GNUzilla
GNUzilla

Reputation: 116

According to Raspberry Pi Docs

First

sudo nano /etc/rc.local

Then you need to add the following before 'exit 0'

python /full/path/to/file/piProgram.py &

Raspberry Pi Docs: https://www.raspberrypi.org/documentation/linux/usage/rc-local.md

You need to specify 'python' before the path to the script

Upvotes: 1

Related Questions