备份mysql和tomcat程序的shell脚本

发布时间:2016-07-31 21:55:51 编辑:javaEE 阅读:(598次)

      


echo $(date +'%Y-%m-%d %H:%M:%S')
cd /root/bak/
DateF=$(date +%Y%m%d)

echo "start sql bak "
DateF=$(date +%Y%m%d)
mysqldump -u root -p123456 yyxf>/root/bak/$DateF-yyxf.sql;
echo "stop sql bak OK"
echo $(date +'%Y-%m-%d %H:%M:%S')
echo "-------------------------------"

tar -zcf $DateF-yyxf.tar.gz /root/tomcat/
echo "tar OK"
echo "-------------------------------"