If you take your Raspberry Pi Zero with you a lot, unplug it at night, or reboot often, you don't want to have to start services and programs manually every single time. Linux has a rich set of tools that control what services start up when the Raspberry Pi does.
We're going to make a copy of our temperature script and add a little bit to it. First, make a copy as a new script, called rpz_startup.sh
. We'll use the cp
command we learned in an earlier recipe:
pi@rpz14101:~/share/ch3 $ cp rpz_temp.sh rpz_start.sh
This file will have some new variables in it, the format will be slightly different, and we will write it directly to our
rpz_startup.log
file in/var/log/
. TheTEMP
andDATE
variables are the same, so you can save yourself the retyping with the copy. The finished script will look like this:#!/bin/bash TEMP=`/opt/vc/bin/vcgencmd measure_temp | cut -d "=" -f 2` DATE=`date` GPU=`/opt/vc/bin/vcgencmd get_mem gpu...