Add shutdown timeout. Update README.md

This commit is contained in:
Dmitri Popov
2018-03-20 09:15:13 +01:00
parent 9e5026c4d7
commit 2b46f43e59
2 changed files with 10 additions and 3 deletions

View File

@@ -5,11 +5,15 @@
# to install the required packages and configure the system.
# Specify a storage device and its mount point
HOME_DIR="/home/pi"
HOME_DIR="/home/pi" # Home directory path
SHUTD="5" # Minutes to wait before shutdown due to inactivity
# Set the ACT LED to heartbeat
sudo sh -c "echo heartbeat > /sys/class/leds/led0/trigger"
# Shutdown after a specified period of time (in minutes) if no device is connected.
sudo shutdown -h $SHUTD "Shutdown is activated. To cancel: sudo shutdown -c"
# Wait for camera
DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//')
while [ -z ${DEVICE} ]
@@ -18,6 +22,9 @@ while [ -z ${DEVICE} ]
DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//')
done
# Cancel shutdown
sudo shutdown -c
# Obtain camera model
# Create the target directory with the camera model as its name
CAMERA=$(gphoto2 --summary | grep "Model" | cut -d: -f2 | tr -d '[:space:]')