backuppcExportOnUsbDisk/run-bkp-usb
2017-02-28 15:13:49 +01:00

23 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