Last active
October 10, 2015 17:03
-
-
Save stepankuzmin/c91d96c52fd477e13e72 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| green=`tput setaf 2` | |
| reset=`tput sgr0` | |
| dt=`date '+%Y.%m.%d_%H-%M-%S'` | |
| backup_path=$HOME/backup/$dt | |
| db_backup=$backup_path/astrakhan_production.sql | |
| uploads_backup=$backup_path/uploads.tar.bz2 | |
| mkdir -p $backup_path | |
| pg_dump --no-owner --no-acl astrakhan_production -f $db_backup | |
| tar cvjf $uploads_backup -C $HOME/repository/portal/shared/public uploads | |
| echo $backup_path | |
| echo "${green}[*] Done: $backup_path${reset}" | |
| # delete all files older than week from now | |
| find $HOME/backup -mtime +7 -exec rm {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment