From cf91fbd2247f211e70076a563e62e3ad92bc3c27 Mon Sep 17 00:00:00 2001 From: gitea Date: Wed, 1 Nov 2023 11:01:24 +0800 Subject: [PATCH] [modify] rsync will sync everything to backup dir, but tar will exlude some big folder instead, and fix wrong scp --- update/backups.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/update/backups.sh b/update/backups.sh index ce42ccf..9ebb902 100644 --- a/update/backups.sh +++ b/update/backups.sh @@ -19,11 +19,11 @@ cp -rf /root/.ssh/config /opt/configs/conf/ cp -rf /etc/samba/smb.conf /opt/configs/conf/ cp -rf /etc/network/interfaces /opt/configs/conf/ cp -rf /root/.acme.sh/*ecc /opt/configs/acme/ -cp -rf /opt/wd/25-Syncthing/common/A_Program/FRP/* /opt/apps/frp/frpc-xtcp-visitor +cp -rf /opt/apps/syncthing/data/common/A_Program/FRP/* /opt/apps/frp/frpc-xtcp-visitor/ cd /opt && t=`date +%Y%m%dT%H%M%S` -rsync --delete-after -avz --exclude=apps/localcr/B_koel/local/music apps configs logs scripts websites wd/72-Backups/VPS/ > /opt/logs/rsync/rsync_${t}.log -# rsync --delete-after -avz /opt/apps/syncthing/data/* wd/72-Backups/Syncthing/ > /opt/logs/rsync/rsync_${t}.log +# rsync --delete-after -avz --exclude=apps/localcr/B_koel/local/music apps configs logs scripts websites wd/72-Backups/VPS/ > /opt/logs/rsync/rsync_${t}.log +rsync --delete-after -avz apps configs logs scripts websites wd/72-Backups/VPS/ > /opt/logs/rsync/rsync_${t}.log cd /opt/logs/rsync/ let count=`ls | wc -l` if [[ $count -gt 10 ]]; then @@ -39,11 +39,18 @@ fi # on 1st of every month, do a compress if [[ `date +%d` == '01' ]]; then - t=`date +%Y%m%d%H%M%S` - tar -I pixz -cf /opt/wd/72-Backups/vps-${t}.tar.gz /opt/wd/72-Backups/VPS > /dev/null 2>&1 - scp -r /opt/configs/certs/ arm1:/opt/ 2>&1 /dev/null & - scp -r /opt/configs/certs/ arm2:/opt/ 2>&1 /dev/null & - scp -r /opt/configs/certs/ amd:/opt/ 2>&1 /dev/null & + t=`date +%Y%m%d%H%M%S` && cd /opt/wd/72-Backups/ + + tar -I pixz -cf vps-${t}.tar.gz \ + --exclude=VPS/apps/localcr/B_koel/local/music \ + --exclude=VPS/apps/localcr/I_cloudreve/local/cloudreve/uploads \ + --exclude=VPS/apps/localcr/K_nextcloud/local/nextcloud/data/nextcloud/files \ + --exclude=VPS/apps/syncthing/data \ + VPS/ > /dev/null 2>&1 + + scp -r /opt/configs/certs/ arm1:/opt/ > /dev/null 2>&1 & + scp -r /opt/configs/certs/ arm2:/opt/ > /dev/null 2>&1 & + scp -r /opt/configs/certs/ amd:/opt/ > /dev/null 2>&1 & wait fi set +x