I've followed many tutorials on how to do this now but none seemed to have done anything.
The way I'm currently trying is having a script in /etc/init.d/test
The script in that is as follows:
- Code: Select all
#! /bin/sh
# /etc/init.d/test
### BEGIN INIT INFO
# Provides: noip
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Simple script to start a program at boot
# Description: A simple script which will start / stop a program a boot /$
### END INIT INFO
# If you want a command to always run, put it here
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Hello!"
sleep 10s
sudo python /home/pi/Desktop/Projects/test.py
;;
stop)
;;
*)
echo "Bye!"
sleep 10s
killall python
exit 1
;;
esac
exit 0
I put in the sleep commands so that I could definitely be sure it had run.
When I run the command:
sudo /etc/init.d/test start
Everything runs as expected with the 10 second pause and then it runs the python script.
When I reboot it just runs though all the normal lines of code(or what ever all the writing is) and goes to the desktop. Why might the script not be running?