mysql linux备份shell

#!/bin/bash
# export and backup the activity.sql
  mysqldump  -uname -password activity --skip-lock-tables > /home/public_html/mysql_auto_backup/activity.sql
#zip the code and activity.sql
  cd /home/public_html/mysql_auto_backup/
  tar -zcvf /home/public_html/mysql_auto_backup/activity$(date +%Y%m%d%H%M).tar.gz activity.sql
#delete the activity.sql
  rm -f /home/public_html/mysql_auto_backup/activity.sql
#delete backup zip  10 days ago    
DAYS=10
  find  /home/public_html/mysql_auto_backup/ -name "activity*" -type f -mtime +$DAYS -exec rm {} \;

上一篇:大并发大数量中的MYSQL瓶颈与NOSQL介绍


下一篇:pycharm Working directory error