Debian – How to run scripts on headless startup

debianstartup

How can I run a shell script when my Raspberry Pi starts up headless?

I don't want it to be dependent on booting into a console, or logging in, etc. It will literally be plugged into Ethernet and power, nothing else.

I saw this post on RPi SE. The answer was really thorough, but depended on things like logging in, booting to desktop, or booting to console.

How can I run a script on powerup, even if none of these things happen?

Thanks!

evamvid

Best Answer

You can either add the script to your rc.local file located in /etc/, or create an init script.

One of the easiest ways to create an init script is to use 'pleaserun' . You'll want to use sysv as your platform target. https://github.com/jordansissel/pleaserun