Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀

André Rocha andrecgro

🚀
View GitHub Profile
@andrecgro
andrecgro / backup.sh
Created Jul 19, 2017
this gist backup a whole folder and database, send it to a dropbox account, and exclude oldest backups, keeping only the two newest
View backup.sh
#!/bin/sh
# This script creates a compressed backup archive of the given directory and the given MySQL table.
# After that, saves the compressed file to a folder you named, send it to a dropbox account(assuming that you have dropbox uploader[http://bit.ly/dropbox_uploader]),
# and then excludes the oldest files, keeping only the two newest on the server (the dropbox receives ALL files and do not exclude)
# Feel free to use this script wherever you want, however you want.
# Author: André Camargo Rocha(https://www.github.com/andrecgro), in June 2017
# Set the date format, filename and the directories where your backup files will be placed and which directory will be archived.
NOW=$(date +"%Y-%m-%d")
SITE_FILE="NAME_OF_YOUR_COMPRESSED_BACKUP_$NOW.tar"