#!/bin/bash
#this is a scr ipt of mysql backup
if [ ! -d /mydata/data1/backup ] ;then
mkdir /mydata/data1/backup
fi
cd /mydata/data1/backup
file=$(find . -type f -mtime -7 | grep .*all.sql) #查找7天内是否有备份的文件
echo $file
if [ -z $file ] ;then
echo "bac
Linux 服务器上的程序每天都在更新 MySQL 数据库,于是就想起写一个 shell 脚本,结合 crontab,定时备份数据库。其实非常简单,主要就是使用 MySQL 自带的 mysqldump 命令。
#!/bin/bash
# Shell scr ipt to backup MySql database
# To backup Nysql databases file to /backup dir and later pick up by your
# scr ipt. You c