Backups - CustodesTechnologia/System GitHub Wiki

Bolter and Chainsword

Backups

  1. Run via `cron
  2. Subject to change, this is just the initial set of tasks.

Setup

mysqldump will need a mechanism to know the use and password.

Make a ~/.my.cnf file and put this:

Edit accordingly.

Make file mode 0600. Ensure go-rwx.

`` [client] user=USER_FROM_CONFIG password=DUH

[mysql] database=DATABASE_NAME ``

Current List of Tasks

BU_HOME is the directory root for all backups.

# Every day at 10:00 UTC, run daily backup
00 10 * * * /usr/bin/rsync \
            -av \
            --delete \
            DocumentRoot BU_HOME/daily

# Every Monday at 14:00 UTC, 
# run weekly backup of the daily backups.
00 14 * * 1 /usr/bin/rsync \
            -av \
            --delete \
            BU_HOME/daily BU_HOME/weekly

# Every First of the Month,
# at 18:00 UTC, 
# run monthly backup of the weekly backups.
00 18 1 * * /bin/tar \
            -cvjf \
            BU_HOME/monthly/monthly_$(date +%Y%m%d).tar.bz2 BU_HOME/daily

# Every 10 minutes,
# run the Site Software Task.
# (They recommend every minute. Why? Not sure..)
*/10 * * * * cd DocumentRoot && \
             /usr/bin/php \
             -d memory_limit=-1 \
             -d max_execution_time=0 \
             PATH_TO_UPDATE_TASK KEY

# Every day at 08:22
#  backup the database records
22 08 * * * /usr/bin/mysqldump \
            --routines \
            --single-transaction \
            --triggers \
            --result-file=\
            /var/backup/db_$(date +%Y%m%d).sql \
            --databases DATABASE_NAME > /dev/null

What's Missing?

Log/backup cleaning and rotation.