#!/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 --delete --exclude-from /root/.backup_excludes naz:/mnt/md1/ /mnt/usb/