Kali Raspberry Pi/Startup Services: Difference between revisions
From charlesreid1
(Created page with "===By The Way: Modifying Headless Raspberry Pi Boot Sequence=== Part of my struggles in debugging the issue above led me to the <code>rc.d</code> and <code>init.d</code> on...") |
No edit summary |
||
| Line 1: | Line 1: | ||
= | =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 <code>rc.d</code> and <code>init.d</code>, 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 <code>/etc/rc2.d</code>. | |||
But the way you should do this is, first put a service script into <code>/etc/init.d/myservice</code>, and make it executable with <code>chmod +x /etc/init.d/myservice</code>. This script should look like other init scripts in the <code>/etc/init.d</code> folder. | |||
Now create a symbolic link in <code>/etc/rc2.d</code> with the command <code>ln -fs /etc/init.d/myservice /etc/rc2.d/</code> | |||
More details here: http://raspberrywebserver.com/serveradmin/run-a-script-on-start-up.html | More details here: http://raspberrywebserver.com/serveradmin/run-a-script-on-start-up.html | ||
Revision as of 02:31, 18 January 2016
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