From cb9cdf0d3874536de2216d205090e8ed57691101 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sat, 21 May 2022 20:28:28 -0400 Subject: [PATCH] bk.sh: Restructure --- src/.local/bin/bk.sh | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/.local/bin/bk.sh b/src/.local/bin/bk.sh index b2fa47e..e9982fe 100755 --- a/src/.local/bin/bk.sh +++ b/src/.local/bin/bk.sh @@ -1,16 +1,34 @@ #!/bin/sh # Remote backup script +# Either push files to remote or receive full backup tarballs + +while getopts ":pr" o; do + case "${o}" in + p) ACTION=PUSH ;; + r) ACTION=RECV ;; + esac +done + +if [ $ACTION = PUSH ] +then + rsync -avzP \ + --chown=dogeystamp:sftpr \ + --exclude=med/mus \ + --exclude=med/gv \ + --exclude=dox/dow \ + --exclude=dox/rss \ + --exclude=dox/rem \ + --exclude=dox/proj \ + --exclude=dox/vms \ + --exclude=med/pix/hdri \ + --exclude=med/memes/woof/quar \ + ~/med ~/dox dogeystamp@lambda:/mnt/disk/uv/ +fi + +if [ $ACTION = RECV ] +then + rsync -avzP \ + dogeystamp@lambda:~/mnt/disk_b/ ~/arc/bk/ +fi -rsync -avzP \ - --chown=dogeystamp:sftpr \ - --exclude=mus \ - --exclude=gv \ - --exclude=dow \ - --exclude=rss \ - --exclude=rem \ - --exclude=proj \ - --exclude=vms \ - --exclude=pix/hdri \ - --exclude=memes/woof/quar \ - ~/med ~/dox dogeystamp@lambda:/mnt/disk/uv/