Skip to content

Instantly share code, notes, and snippets.

@mche
Last active June 13, 2017 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mche/db2375eb12849a12c0c334d2573aabe8 to your computer and use it in GitHub Desktop.
Save mche/db2375eb12849a12c0c334d2573aabe8 to your computer and use it in GitHub Desktop.
Бакапы на гитхабе
cd ~/проектХ
# ветку бакапов
git branch backup
# crontab -e
NDAY=`date '+%u'`
WDAY=`date '+%A'`
57 3 * * * cd ~/проектХ; git checkout backup; pg_dump -U postgres --schema=public test | gpg -q --batch --yes -e -r my@email.ru --trust-model always -z 9 > public.$NDAY.pg.dump.gpg; git add public.$NDAY.pg.dump.gpg; git commit -m "$WDAY"; git checkout master; git push origin backup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment