Skip to content

Latest commit

 

History

History
39 lines (37 loc) · 553 Bytes

README.md

File metadata and controls

39 lines (37 loc) · 553 Bytes

runonbootpi

Run scripts on startup Raspberry PI

  1. Create a bash script
sudo nano start.sh

Example:

#!/bin/sh
sleep 10
cd /
cd home/pi/
sudo python program.py &
cd /

sleep 10 is needed to load system respos first

  1. Change rights to 775
sudo chmod 775 start.sh
  1. Make a crontab
sudo crontab -e
  1. Make a log file to catch all the errors
mkdir logs
chmod 775 logs
  1. Add the following line to the crontab
@reboot sudo sh /home/pi/start.sh >/home/pi/logs/cronlog 2>&1
  1. Now reboot
sudo reboot