2,187
edits
m (Added GRANT for backup user) |
m (→The Script: Updated URL in script) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
#* <code> chmod +x /backup/mysql.sh </code> | #* <code> chmod +x /backup/mysql.sh </code> | ||
# Perform a test run of the backup | # Perform a test run of the backup | ||
# Schedule the script to run with crontab | # Schedule the script to run with crontab | ||
#* <code> crontab -e </code> | #* <code> crontab -e </code> | ||
Line 32: | Line 31: | ||
# Simon Strutt (Apr 2012) | # Simon Strutt (Apr 2012) | ||
# | # | ||
# See | # See https://vwiki.co.uk/Backup_MySQL_(Ubuntu) | ||
### MySQL Server Login and local backup info ### | ### MySQL Server Login and local backup info ### | ||
Line 80: | Line 79: | ||
else | else | ||
# Is backup required? | # Is backup required? | ||
DBUPDATE=`mysql -u | DBUPDATE=`mysql -u $MUSER -h $MHOST -p$MPASS -Bse "SELECT max(update_time) FROM information_schema.tables WHERE table_schema='${db}'"` | ||
DBUPDATEU=`date --date "${DBUPDATE}" +%s` | DBUPDATEU=`date --date "${DBUPDATE}" +%s` | ||
#Logger "$db last update was $DBUPDATE" | #Logger "$db last update was $DBUPDATE" | ||
if [ -f ${STAMPS}/${db} ] | if [ -f ${STAMPS}/${db} ] | ||
then | then | ||
BAKDATE=` | BAKDATE=`cat ${STAMPS}/${db}` | ||
BAKDATEU=`date --date "${BAKDATE}" +%s` | BAKDATEU=`date --date "${BAKDATE}" +%s` | ||
#Logger "$db last backup was $BAKDATE" | #Logger "$db last backup was $BAKDATE" |