Now, obviously, we don't want to have to manually start the alarm control script each time the Raspberry Pi boots up, for example, after a power failure—for a start, we may not even be there. Therefore, we need to set up our operating system so that it will automatically start up the
alarm-control.sh script at boot time.
To do this, we need to edit the
rc.local file using Nano:
$ sudo nano /etc/rc.local
Before the line containing
exit 0, insert the following line:
sudo /etc/pi-alarm/alarm-control.sh &
& symbol at the end of the line is important because it will then make the script run in a different process, otherwise the
rc.local script would never exit.
rc.local file should now look something like ...