Update gauntmta_backup.sh

This commit is contained in:
2019-01-07 14:54:05 -05:00
parent c9328ea8e5
commit e5431bb2ce

View File

@@ -11,13 +11,12 @@ crontab -l > /root/crontab.txt
# create the backup
tar -cpSzf "${TAR}" --exclude="${BACKUP_DIR}" --exclude=/var/cache --exclude=/var/mail ${DIRS_TO_BACKUP}
# sync the backup directory to seafile
rclone sync /backups/ seafile:
# only keep 14 copies on local disk, seafile will keep deleted history
# https://stackoverflow.com/questions/25785/delete-all-but-the-most-recent-x-files-in-bash
ls -tp | grep -v '/$' | tail -n +15 | xargs -I {} rm -- {}
ls -tp "${BACKUP_DIR}" | grep -v '/$' | tail -n +15 | xargs -I {} rm -- {}
# sync the backup directory to seafile
rclone sync "${BACKUP_DIR}" seafile:
:'
# this is so ugly, need a better solution for what programs are installed/used and their configurations.