zoukankan      html  css  js  c++  java
  • mysql linux 备份脚本

    1. #!/bin/sh
    2. # mysql data backup script
    3. #
    4. # use mysqldump --help,get more detail.
    5. #
    6. BakDir=/root/back/mysql
    7. LogFile=/root/back/mysql/mysqlbak.log
    8. DATE=`date +%Y%m%d%H%M%S`
    9. echo " " >> $LogFile
    10. echo " " >> $LogFile
    11. echo "-------------------------------------------" >> $LogFile
    12. echo $(date +"%y-%m-%d %H:%M:%S") >> $LogFile
    13. echo "--------------------------" >> $LogFile
    14. cd $BakDir
    15. DumpFile=$DATE.sql
    16. GZDumpFile=$DATE.sql.tar.gz
    17. /usr/local/bin/mysqldump -u user -pname  --database -h 127.0.0.1 db> $DumpFile
    18. echo "Dump Done" >> $LogFile
    19. tar czvf $GZDumpFile $DumpFile >> $LogFile 2>&1
    20. echo "[$GZDumpFile]Backup Success!" >> $LogFile
    21. rm -f $DumpFile
    22. #cd $BakDir/daily
    23. cd $BakDir   
    24. echo "Backup Done!"
    25. echo "please Check $BakDir Directory!"
    26. echo "copy it to your local disk or ftp to somewhere !!!"
    27. find $BakDir -ctime +30 -exec rm {} ;
    28. echo "delete file over 30 days"
  • 相关阅读:
    常用FPGA功能块记录
    鸿蒙相关
    微波相关
    Python库大全
    C#环境实现代码的自动生成编译
    STM32相关
    硬件相关
    C# 获取枚举中文注释
    C# 获取自定义特性值
    Asp.Net Core 中 Host 与 WebHost的区别
  • 原文地址:https://www.cnblogs.com/taoboy/p/4798694.html
Copyright © 2011-2022 走看看