Created
December 1, 2014 22:38
-
-
Save ademuk/743101b85c4f982b34ec to your computer and use it in GitHub Desktop.
Dokku pgbackup
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
if [ "$#" -ne 4 ]; then | |
echo "Illegal number of parameters" | |
exit | |
fi | |
DB=$1 | |
DESTINATION=$2 | |
NAME=$3 | |
DATE=$(date +"%Y-%m-%d") | |
RETENTION=$4 | |
ssh [email protected] postgresql:dump $DB | gzip -9 > $DESTINATION$NAME$DATE.gz | |
ls $DESTINATION$NAME*.gz | sort -r | awk "NR>$RETENTION" | xargs rm -f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment