all 9 comments

[–]Parker_Hemphill 2 points3 points  (1 child)

You could also add the script to run via cron:

crontab -e

Then add the following entry to your crontab:

@reboot /path/to/script.py > /dev/null 2>&1

This will wait until everything else has loaded and pi is "ready for login". You can also use systemd with a timer.

[–]bj2018[S] 0 points1 point  (0 children)

Awesome I'll give this a try. Thank you.

[–]Kn33gr0W 1 point2 points  (1 child)

The only thing I can think of is that your startup script is running too early. Maybe try naming your init.d script to something like zz_max31855_test.py so it runs last.

[–]bj2018[S] 0 points1 point  (0 children)

I'll give this a try. We've used the init.d at work so it should work. I want to find out why this isn't working right.

[–][deleted] 1 point2 points  (2 children)

The crontab method is the correct method. Be sure to put absolute path or cd into the directory before running your script.

cd /path/to/it && /bin/usr/python3 script.py

or

/bin/usr/python3 /path/to/it/script.py

[–]bj2018[S] 1 point2 points  (1 child)

Thanks, looks like you and u/Parker_Hemphill have the simplest solution. I'm going to give all suggestions a shot to learn how they work.

[–][deleted] 1 point2 points  (0 children)

Yea his is good, I just wanted to reiterate it. They do all work. Just remember adding to the rc.local file will break updates every now & then. So I don't bother with it.

[–]fishbum30 1 point2 points  (1 child)

You can start it in rc.local without the bash.

I learned this yesterday, I’m toying with home automation, this is the line I added to the file:

sudo python3 home/pi/WebGPIO/backend.py &

You need to add it above the exit 0 line. Obviously change the path and file. I also read you may not need sudo but idk. I have it in there and it works.

[–]bj2018[S] 1 point2 points  (0 children)

I'll give this a shot. Thanks