Skip to content

Instantly share code, notes, and snippets.

@rodolfobarretoweb
Created November 4, 2015 13:54
Show Gist options
  • Save rodolfobarretoweb/c20fd5f13d6b9bfb4bc4 to your computer and use it in GitHub Desktop.
Save rodolfobarretoweb/c20fd5f13d6b9bfb4bc4 to your computer and use it in GitHub Desktop.
Backup mysql
#!/bin/sh
# script.sh
# Print the date
DATE=`/bin/date +%d-%m-%Y`
NANE="/your/path/$DATA.sql"
HOST=""
USER=""
PASSWORD=""
DATABASE=""
mysqldump -h $HOST -u $USER -p$PASSWORD $DATABASE > $NAME
# Link to install dropbox on ubuntu server
# https://www.dropbox.com/install?os=lnx
cp $NAME /your/path/Dropbox/your-path-backup-in-dropbox/$DATE.sql
@rodolfobarretoweb
Copy link
Author

VISUAL=vi crontab -e
0 2 * * * /bin/sh /home/user/your-path-to-backup/script.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment