O'Reilly logo

Building a Home Security System with Raspberry Pi by Matthew Poole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building the control script

Now that we have designed our system the way we want it to work, we can start writing our Bash control script. As before, we'll locate our scripts in the folder, /etc/pi-alarm, which, you'll remember from Chapter 7, Building a Web-Based Control Panel, is also where our Web-based control panel writes its configuration status file, alarm.cfg to. We'll be referring to that file in our scripts too.

In this script, we are going to use the bc tool (the Bash command-line calculator) to convert hex values to binary. It's not installed by default, so you'll need to get the package:

$ sudo apt-get update
$ sudo apt-get install bc

Tip

Our script file is quite long so, as before, you might want to sit on the sofa and write it on ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required