scripts/backupnaz.sh

20 lines
514 B
Bash
Raw Normal View History

2015-08-02 12:48:17 +02:00
#!/bin/bash
# Monthly backup script for my NAS
DEVICE=`readlink -f /dev/disk/by-id/usb-ST3000DM_001-1CH166_000000000000-0:0-part1`
if grep $DEVICE /proc/mounts >/dev/null
then
echo "external drive ($DEVICE) seems to be mounted. good."
else
if sudo mount $DEVICE /mnt/usb/
then
echo "external drive ($DEVICE) successfuly mounted."
else
echo "FATAL: unable to mount"
exit 1
fi
fi
2015-08-02 14:19:22 +02:00
time ionice -c 2 sudo rsync --info=progress2 -av --delete --exclude-from /root/.backup_excludes naz:/mnt/md1/ /mnt/usb/