Automatically starting the system
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 &
Note
The &
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.
Your rc.local
file should now look something like this:
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change...