22 lines
434 B
Bash
Executable file
22 lines
434 B
Bash
Executable file
#!/bin/bash
|
|
|
|
FILE=/var/run/bkp-usb-detected
|
|
|
|
function exit_error () {
|
|
echo "$1"
|
|
beep -f 300 -l 2000
|
|
rm -f "$FILE"
|
|
exit 1
|
|
}
|
|
|
|
[ ! -e "$FILE" ] && exit_error "File $FILE does not exists !"
|
|
|
|
DEVICE=$( cat "$FILE" )
|
|
[ ! -e "$DEVICE" ] && exit_error "Device '$DEVICE' does not exists !"
|
|
|
|
echo "Removing $FILE"
|
|
rm -f "$FILE"
|
|
|
|
echo "Run backup on device '$DEVICE'"
|
|
/usr/local/sbin/backup-usb -u "$DEVICE" -l /var/log/bkp-usb.log &
|
|
exit 0
|