From ecf8bb4b0cbef589c16ee35693ddda8fb84b23f6 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Fri, 30 Mar 2018 22:24:13 +0200 Subject: Initial commit, added a skeleton script but need to decide if I'm using the rsync daemon on the master side --- backup | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 backup (limited to 'backup') diff --git a/backup b/backup new file mode 100755 index 0000000..609c282 --- /dev/null +++ b/backup @@ -0,0 +1,37 @@ +#!/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 + + -- cgit v1.2.3