Book Image

Raspberry Pi Essentials

By : Jack Creasey
Book Image

Raspberry Pi Essentials

By: Jack Creasey

Overview of this book

Table of Contents (15 chapters)
Raspberry Pi Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Project 1a – Creating a Bash script to drive raspivid


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:

  1. Open File Manager and create a directory called camera in /home/pi for our work.

  2. Download the picam.sh file from the Chapter 3 folder at http://1drv.ms/1ysAxkl; make it executable and ensure that the owner is pi.

  3. 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 show Status...