
56
Part I: Home Automation
(when the script creates a new fold-
er). So, to make sure everything is
working correctly, grab one of your
motion detectors and press the
“House/On” button. You should see
output that resembles the screenshot
shown in Figure 3-7.
You’ll probably see the script take
a picture immediately because you
triggered the motion detector since
connecting the X10 computer inter-
face. The X10 computer interface
keeps the last few messages in a
queue.
If things don’t work as expected, try moving your X10 computer interface and the
wireless transceiver to different electrical outlets. You might even try connecting
them to outlets right next to each other.
10. Schedule the script
Your script relies on your computer running. You don’t want to have to
remember to restart the script each time the computer restarts, so you
should configure your script to run automatically at startup. To do this,
execute the following commands:
su
echo perl /home/
username/homehacking/pet-monitor.pl >> /etc/rc.d/
rc.local
This adds the Perl command to run your new script to the rc.local file,
which Linux automatically executes at startup. Restart your system, and
the script will automatically run and snap pictures when your pet moves.
You’re done!
If you discover that the script doesn’t work when started automatically, ...