Skip to content

Instantly share code, notes, and snippets.

@tjstein
tjstein / gs-backup.sh
Created November 17, 2009 04:23
gs-backup.sh
#!/bin/bash
# Tar shit up:
today=$(date '+%d_%m_%y')
echo "* Performing domain backup..."
tar czf /var/backups/constantshift.com_"$today".tar.gz -C / var/www/constantshift.com
echo "* Backed up..."
# Remove shit older than 7 days:
MaxFileAge=7
find /var/backups/ -name '*.gz' -type f -mtime +$MaxFileAge -exec rm -f {} \;
# Rsync shit to the grid: