From a92a7ba934736500f3e36a99f476077f807e6666 Mon Sep 17 00:00:00 2001 From: n Date: Sun, 2 Aug 2015 12:48:17 +0200 Subject: [PATCH] Monthly backup script for my NAS --- backupnaz.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 backupnaz.sh diff --git a/backupnaz.sh b/backupnaz.sh new file mode 100755 index 0000000..c26861a --- /dev/null +++ b/backupnaz.sh @@ -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/