Last active
October 30, 2019 14:06
-
-
Save Dilden/3f18c3c6579d94293965739fb21dc523 to your computer and use it in GitHub Desktop.
Copy LXC backups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
THEDATE=`date +%d%m%y%H%M` | |
CONTAINER_PATH="/var/lib/vz/dump/" | |
#MEDIA_PATH="/ mnt/shared/Media" | |
LOCAL_BACKUP_PATH="/media/backups/" | |
# Copy LXC backups (that are < 2 days old) from host to mounted drive | |
find ${CONTAINER_PATH} -name vzdump-lxc-*.tar.gz -mtime -2 -exec cp {} ${LOCAL_BACKUP_PATH} \; | |
# Remove old files (>30 days old) from mounted drive | |
find ${LOCAL_BACKUP_PATH}vzdump-lxc-*.tar.gz -mtime +30 -exec rm {} \; | |
# Backup shared media | |
#if tar czf ${LOCAL_BACKUP_PATH}/media_${THEDATE}.tar.gz -C ${MEDIA_PATH} | |
#then | |
# echo "Media backup successful \n"; | |
#else | |
# echo "Media backup failed \n"; | |
#fi | |
echo "backup complete $THEDATE \n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment