From 4f26415ff44d1f4d731b6def4fc65d1eb4dc38f9 Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Sun, 29 Mar 2020 02:39:42 +0000 Subject: [PATCH] inplace sed --- backup.sh | 48 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 33 insertions(+), 15 deletions(-) diff --git a/backup.sh b/backup.sh index 21f8aea..e0995d2 100755 --- a/backup.sh +++ b/backup.sh @@ -2,8 +2,26 @@ cd /home/joel/OneDrive +if [ $1 == "sync" ]; then + echo Syncing + BACKUP_DIR="/backup/work/" + echo OneDrive Personal + rclone sync $BACKUP_DIR "OneDrive_Personal":/Uni -P + echo NextCloud + rclone sync $BACKUP_DIR "NextCloud":/Uni -P + echo GoogleDrive + rclone sync $BACKUP_DIR "GoogleDrive":/Uni -P + echo Mega + rclone sync $BACKUP_DIR "Mega":/Uni -P + echo unimelb + rclone sync $BACKUP_DIR "unimelb":/ -P + echo sout + rclone sync $BACKUP_DIR "sout":/data/Cloud -P + exit +fi + LAST="$(duplicacy list | tail -n1 | cut -d' ' -f4)" -CURR="$(duplicacy backup | grep "revision [0-9] completed" | sed 's/[^0-9]//g')" +CURR="$(duplicacy backup | tail -n1 | sed 's/[^0-9]//g')" #LAST=2 #CURR=4 DIFF="$(duplicacy diff -r $CURR -r $LAST | grep '-')" @@ -12,18 +30,18 @@ #echo "last - $LAST" #echo "diff - $DIFF" -if [ -z "$DIFF" ]; then - duplicacy prune -r $CURR -exclusive -else - echo "No diff to backup" -fi -duplicacy prune -keep 1:7 -keep 7:30 -exclusive +duplicacy prune -keep 1:7 -keep 7:30 -exclusive > /dev/null 2>&1 -BACKUP_DIR="/backup/work/" -rclone sync $BACKUP_DIR "OneDrive_Personal":/Uni & -rclone sync $BACKUP_DIR "NextCloud":/Uni & -rclone sync $BACKUP_DIR "GoogleDrive":/Uni & -rclone sync $BACKUP_DIR "Mega":/Uni & -rclone sync $BACKUP_DIR "unimelb":/ & -rclone sync $BACKUP_DIR "sout":/data/Cloud & -#rclone sync $BACKUP_DIR "Oracle":/Uni +if [ -z "$DIFF" ]; then + duplicacy prune -r $CURR -exclusive > /dev/null 2>&1 +else + echo "New backup $CURR" + BACKUP_DIR="/backup/work/" + rclone sync $BACKUP_DIR "OneDrive_Personal":/Uni & + rclone sync $BACKUP_DIR "NextCloud":/Uni & + rclone sync $BACKUP_DIR "GoogleDrive":/Uni & + rclone sync $BACKUP_DIR "Mega":/Uni & + rclone sync $BACKUP_DIR "unimelb":/ & + rclone sync $BACKUP_DIR "sout":/data/Cloud & + #rclone sync $BACKUP_DIR "Oracle":/Uni +fi -- Gitblit v1.9.3