Monthly backup script for my NAS

This commit is contained in:
n 2015-08-02 12:48:17 +02:00
parent 7f7e5bec5a
commit a92a7ba934
1 changed files with 19 additions and 0 deletions

19
backupnaz.sh Executable file
View File

@ -0,0 +1,19 @@
#!/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
time ionice -c 2 sudo rsync --info=progress2 -av --exclude-from /root/.backup_excludes naz:/mnt/md1/ /mnt/usb/