Last active
December 12, 2020 22:00
-
-
Save peerasan/187993313b4ce2d41d6a836ee1e81918 to your computer and use it in GitHub Desktop.
simple folder backup
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/bash | |
DATE=$(date +%Y-%m-%d) | |
BACKUP_DIR="/mnt/backup-web/" | |
# To create a new directory into backup directory location. | |
#mkdir -p $BACKUP_DIR/$DATE | |
# take each website backup in separate name, use below format. | |
tar -zcvpf $BACKUP_DIR/my-website-$DATE.tar.gz /my-website | |
# Delete files older than X days | |
find $BACKUP_DIR/* -type f -mtime +3 -exec rm {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment