From charlesreid1

Revision as of 02:31, 18 January 2016 by Admin (talk | contribs)

Modifying Raspberry Pi Boot Sequence

If you want to add startup services to your Raspberry Pi (and there are many useful applications of having programs start automatically when the Pi is plugged in, as opposed to having to be started manually, RaspberryPi/Reverse SSH being one of them), you can mount the SD card on another computer and modify the rc.d and init.d, and modify the services that start on boot.

First, load up the SD card and mount it. You will need to mount the filesystem partition of the SD card, which is an ext4 filesystem. If you are on a Mac, you will need to install MacFUSE to read an ext4 file system. If you are on Linux, you are good to go. (If you are on Windows... may God have mercy on your soul.)

Once you've mounted the Pi's filesystem, you will want to change what starts at different runtime levels. Debian Raspberry Pis start in runtime level 2 by default, so anything you want to start up should go into /etc/rc2.d.

But the way you should do this is, first put a service script into /etc/init.d/myservice, and make it executable with chmod +x /etc/init.d/myservice. This script should look like other init scripts in the /etc/init.d folder.

Now create a symbolic link in /etc/rc2.d with the command ln -fs /etc/init.d/myservice /etc/rc2.d/

More details here: http://raspberrywebserver.com/serveradmin/run-a-script-on-start-up.html