Add inactivity shutdown
This commit is contained in:
@@ -13,6 +13,9 @@ CARD_MOUNT_POINT="/media/card"
|
|||||||
# Set the ACT LED to heartbeat
|
# Set the ACT LED to heartbeat
|
||||||
sudo sh -c "echo heartbeat > /sys/class/leds/led0/trigger"
|
sudo sh -c "echo heartbeat > /sys/class/leds/led0/trigger"
|
||||||
|
|
||||||
|
# Shutdown after 7 minutes if no device is connected.
|
||||||
|
sudo shutdown -h 7 "Shutdown is activated. To cancel: sudo shutdown -c"
|
||||||
|
|
||||||
# Wait for a USB storage device (e.g., a USB flash drive)
|
# Wait for a USB storage device (e.g., a USB flash drive)
|
||||||
STORAGE=$(ls /dev/* | grep $STORAGE_DEV | cut -d"/" -f3)
|
STORAGE=$(ls /dev/* | grep $STORAGE_DEV | cut -d"/" -f3)
|
||||||
while [ -z ${STORAGE} ]
|
while [ -z ${STORAGE} ]
|
||||||
@@ -24,6 +27,9 @@ done
|
|||||||
# When the USB storage device is detected, mount it
|
# When the USB storage device is detected, mount it
|
||||||
mount /dev/$STORAGE_DEV $STORAGE_MOUNT_POINT
|
mount /dev/$STORAGE_DEV $STORAGE_MOUNT_POINT
|
||||||
|
|
||||||
|
# Cancel shutdown
|
||||||
|
sudo shutdown -c
|
||||||
|
|
||||||
# Set the ACT LED to blink at 1000ms to indicate that the storage device has been mounted
|
# Set the ACT LED to blink at 1000ms to indicate that the storage device has been mounted
|
||||||
sudo sh -c "echo timer > /sys/class/leds/led0/trigger"
|
sudo sh -c "echo timer > /sys/class/leds/led0/trigger"
|
||||||
sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on"
|
sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on"
|
||||||
|
|||||||
Reference in New Issue
Block a user