Last active
September 26, 2016 20:53
-
-
Save turbopixel/be6e9199462b4d107ab8b36a709239f3 to your computer and use it in GitHub Desktop.
MySQL Dump Cronjob
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# MySQL Console Dumper | |
# author: Nico Hemkes <www.nokes.de> | |
# date: 26.09.2016 | |
# settings | |
user="USER" | |
pw="PASSWORD" | |
backupDir="/media/backup/" | |
today=$(date +"%m-%d-%Y") | |
filename="mysql_dump-$today.sql.gz" | |
# output start | |
printf "\n= = = MySQL Console Dumper = = =" | |
printf "\nstarting ...\n\n" | |
# dump | |
mysqldump -u"$user" -p"$pw" -Q --events --ignore-table=mysql.event --all-databases | gzip -9 > $backupDir$filename | |
# output end | |
printf "Backup placed at $backupDir$filename\n\n" | |
printf "done!\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment