Last active
August 16, 2017 18:18
-
-
Save clintliang/c6e4fdade6ff39600a56c696aa29b729 to your computer and use it in GitHub Desktop.
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 | |
backup_dir="" | |
#String to append to the name of the backup files | |
backup_date=`date +%d-%m-%Y` | |
db="" | |
#Numbers of days you want to keep copie of your databases | |
pg_dump -b --data-only -T '"SequelizeMeta"' $db>$backup_dir/$db\_$backup_date.sql | |
# Numbers of days you want to keep the dumps | |
number_of_days=7 | |
find $backup_dir -type f -name "*.sql" -prune -mtime +$number_of_days -exec rm -f {} \; |
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 | |
backup_dir="" | |
# Numbers of days you want to keep the dumps | |
number_of_days=7 | |
find $backup_dir -type f -name "*.sql" -prune -mtime +$number_of_days -exec rm -f {} \; |
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 | |
backup_dir="" | |
key_dir="" | |
remote_backup_dir="username@hostname:dir/" | |
rsync -avz -e "ssh -i $key_dir" $backup_dir/*.sql $remote_backup_dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment