Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a backup script to send backups over email when changed #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gasche
Copy link
Contributor

@gasche gasche commented Mar 24, 2018

This is a home-grown backup script that I built for a local HotCRP
installation, but I thought that it may be useful to others as
well. The backup strategy is detailed as follows:

  • a backups/ directory at the project root with at most two backups saved,
    the last one (new) and the one before that (old)

  • whenever the script runs, it moves new to old and creates a new
    new file using the backupdb.sh script; then it compares new
    and old, and sends the new backup by email if it differs from the
    old one

  • if a passphrase file exists in the backups directory, then
    it is used as a passphrase for gpg to encrypt the backup file

Implementation remarks:

  • we are careful to pass --skip-dump-date to mysqldump, otherwise the backups would always differ
  • we are careful to cd to its base directory, so that the script can be invoked directly from a crontab.

This is a home-grown backup script that I built for a local HotCRP
installation, but I thought that it may be useful to others as
well. The backup strategy is as follows:

- a backups/ directory at the project root with at most two backups saved,
  the last one (`new`) and the one before that (`old`)

- whenever the script runs, it moves `new` to `old` and creates a new
  `new` file using the `backupdb.sh` script; then it compares `new`
  and `old`, and sends the new backup by email if it differs from the
  old one

- if a `passphrase` file exists in the `backups` directory, then
  it is used as a passphrase for `gpg` to encrypt the backup file

Finally, note that we are careful to pass `--skip-dump-date` to
`mysqldump`, otherwise the backups would always differ.

The script is careful to `cd` to its base directory, so that it can be
invoked directly from a crontab.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant