Skip to content

Instantly share code, notes, and snippets.

@richardkall
richardkall / backup-db.sh
Last active October 12, 2015 04:17
Backup MySQL database to Amazon S3.
#!/bin/sh
# Dumps MySQL database to a file, uploads to S3 and rotates out old backups.
# Set correct dates
NOWDATE=`date +%Y-%m-%d`
LASTDATE=$(date +%Y-%m-%d --date='1 week ago')
DESTINATION=/var/backup
DB=

Setup remote git repo on EC2

Create a bare repository

$ mkdir <repo-name>.git
$ cd <repo-name>.git
$ git init --bare