More Startup Processing – init.d & update-rc.d
June 28, 2016
Posted by on
While working on an implementation of the Raspberry Pi Camera module, we were looking to run the device remotely and headless. We came across this knowledge in conjunction with implementing the pi-timolo code and found it useful for a variety of applications.
A good example for this is when you have written an application in python, and you want to have it execute automatically on startup.
- To auto launch the application, you’ll want to create a shell script.
- Once you have created this script, you’ll copy it to the init.d folder.
- check the permissions to be sure your user can execute the script:
- ls -la /etc/init.d/yourscript.sh
- cd /etc/init.d
- chmod +x yourscript.sh
- Now set it up to execute on boot:
- sudo update-rc.d yourscript.sh defaults
When you reboot after completing the steps above, the program should automatically start!