Posts: 4
Joined: Thu Apr 06, 2017 10:39 pm

Run Python script at startup

Thu Apr 13, 2017 12:21 am


I have been reading a bunch of answers on how to run a Python script at startup for the Raspberry Pi 3. Unfortunately, nothing has been working so far. I have tried the crontab -e method, with or without a sleep, without success. I have made my script executable by 'anyone'. I have also include the '#! bash /usr/bin/env python line at the top.

Can anybody help me go step-by-step through this to figure where I am going wrong ? I have been using a simple script that only has the print("Hello World") line, no success...

I am getting very frustrated... help.


Posts: 410
Joined: Tue Oct 14, 2014 5:21 pm

Re: Run Python script at startup

Thu Apr 13, 2017 5:15 am

There are many ways to run a python script at startup. The way I have been doing it is by creating a .service file with where I send a command string to the python interpreter. Then I use a .timer file to start it at boot. The problem with printing a text to the display, is though, that where will you be wanting to see this text? For example, if you use a standard Raspbian install and boot to the Desktop after the splash screen, then you will not see the print on the screen even if the script runs.... Can you describe your setup in more detail?

Return to “Advanced users”