#!/bin/bash #SQL文件将要存放的路径 basepath_sql=‘/home/work/local/cms_sql_bak‘ #/home/work/local/cms_sql_bak savepath_sql=$basepath_sql/$(date +%Y)/$(date +%m) #创建目录 mkdir -pv $savepath_sql/ mysql_bin=‘/home/work/.jumbo/bin‘ $mysql_bin/mysqldump -uroot -padmin -h10.48.31.126 -P8006 --extended-insert=TRUE --database Vs_Finance_cms > $savepath_sql/Vs_Finance_cms_$(date +%Y)-$(date +%m)-$(date +%d)-$(date +%H).sql
配置定时:
* */1 * * * /home/work/local/cms_sql_bak/saveSQL.sh >> /home/work/local/cms_sql_bak/saveSQL.log 2>&1
时间: 2024-10-13 15:40:35