-2
我們正在尋找使用以下備份腳本來移動datavol文件夾中的每個目錄,但它似乎在第4行失敗。如果任何人有更好的方法來做到這一點,請隨時讓我知道。備份腳本 - 遞歸
for d in /home/datavol/ ; do
echo "$d"
tar -czf /backups/emalee-backup-$d-$(date +%Y-%m-%d).tar.gz /home/datavol/$d
scp -i /root/.ssh/id_rsa_backup /backups/emalee-backup-$d-$(date +%Y-%m-%d).tar.gz [email protected]:/home/emalee-backup/docker-backup
curl -X POST --data-urlencode 'payload={"channel": "#server","text": "We are all backed up. Good ol Emalee is safe on /"$d/". :pride:"}' https://hooks.slack.com/services/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
rm /backups/emalee-backup-$d-$(date +%Y-%m-%d).tar.gz -f
ssh -i /root/.ssh/id_rsa_backup [email protected]
find /home/emalee-backup/docker-backup/ -mtime +7 -exec rm -f {} \;
TODAYSDATE=$(date +%d)
if [ "$TODAYSDATE" == "01" ] ;
then
cp /home/emalee-backup/docker-backup/emalee-backup-$d-$(date +%Y-%m-%d).tar.gz /home/emalee-backup/monthly-docker-backup/emalee-backup-$d-$(date +%Y-%m-%d).tar.gz
curl -X POST --data-urlencode 'payload={"channel": "#server","text": "Archived a monthly backup for good ol Emalee on $d. :handbag:"}' https://hooks.slack.com/services/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
fi
done
logout
看看你的終端,當'回聲 「$ d」' –
這絕對不是[標籤:批處理文件] - 相關(讀取標籤信息)! – aschipfl