In this project, we will use a small Bash shell script using the command line shown to instantiate raspivid as a root process. The script will only start raspivid if there is no instance already running, and it will start the process in a paused mode. Command-line parameters will let us start or pause recording and unload the process.
The following steps show you how to get started:
Open File Manager and create a directory called camera in
/home/pi
for our work.Download the
picam.sh
file from theChapter 3
folder at http://1drv.ms/1ysAxkl; make it executable and ensure that the owner is pi.Open
picam.sh
in the Leafpad editor.
The Bash script code for picam.sh
is fully documented in the file; however, here is a quick overview of some of the important elements of the script:
A case statement is used to allow the user to execute the file specifying one of the five command actions as a parameter. We can
Load
,Quit
,Record
,Pause
, or showStatus...