Skip to content

Instantly share code, notes, and snippets.

@veryyoung
Last active September 26, 2016 11:36
Show Gist options
  • Select an option

  • Save veryyoung/0ea4ab5fe34476163e4f477ce830749c to your computer and use it in GitHub Desktop.

Select an option

Save veryyoung/0ea4ab5fe34476163e4f477ce830749c to your computer and use it in GitHub Desktop.
定时备份数据
#! /bin/Bash
# config in crontab 30 23
# 30 23 * * * sh /root/backup/backup.sh>>/root/backup/backup.log
DB_USER='root'
DB_PASSWORD=''
DB_NAME='test'
BACKDIR='/root/backup'
currentDate=`date +%F`
echo $currentDate
/usr/bin/mysqldump --user=${DB_USER} --password=${DB_PASSWORD} ${DB_NAME}>${BACKDIR}/${DB_NAME}_${currentDate}.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment