#!/usr/bin/zsh # rsyncs data from one mount point to another. By default all subdirectories of the src mount point are copied to the dst mount point. Nothing happens unless both arguments are valid mount points. RSYNC_OPTS='-aP \ --no-owner \ --delete-during \ --exclude="lost+found"' if [ $# -lt 2 ]; then echo "Usage: backup " exit 1 fi if [ ! -e $1 ]; then echo "$1 does not exist" exit 1 fi if [ ! -e $2 ]; then echo "$2 does not exist" exit 1 fi lsblk | awk '{ print $7 }' | grep -Fx "$1" > /dev/null if [ $? -ne 0 ]; then echo "$1 is not a mount point" exit 1 fi lsblk | awk '{ print $7 }' | grep -Fx "$2" > /dev/null if [ $? -ne 0 ]; then echo "$2 is not a mount point" exit 1 fi