1
2
3
4
5
6
7
8
9
|
#!/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
|
* *
/1
* * *
/home/work/local/cms_sql_bak/saveSQL
.sh >>
/home/work/local/cms_sql_bak/saveSQL
.log 2>&1
|
本文转自 梦朝思夕 51CTO博客,原文链接:http://blog.51cto.com/qiangmzsx/1576551