diff --git a/scripts/device-backup.sh b/scripts/device-backup.sh deleted file mode 100755 index 093a41f..0000000 --- a/scripts/device-backup.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env bash - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# IMPORTANT: -# Run the install-little-backup-box.sh script first -# to install the required packages and configure the system. - -# Specify devices and their mount points -# and other settings -STORAGE_DEV="sda1" # Name of the storage device -STORAGE_MOUNT_POINT="/media/storage" # Mount point of the storage device -SOURCE_DIR="/home/pi/BACKUP/" -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 a USB storage device (e.g., a USB flash drive) -STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3) -while [ -z ${STORAGE} ] - do - sleep 1 - STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3) -done - -# When the USB storage device is detected, mount it -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 -sudo sh -c "echo timer > /sys/class/leds/led0/trigger" -sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on" - -# Perform backup using rsync -rsync -av "$SOURCE_DIR" "$STORAGE_MOUNT_POINT" - -# Turn off the ACT LED to indicate that the backup is completed -sudo sh -c "echo 0 > /sys/class/leds/led0/brightness" - -# Shutdown -sync -shutdown -h now