[mysql]每日备份shell脚本
时间:2021-07-01 10:21:17
帮助过:31人阅读
user=
"radius"
password=
""
host=
"localhost"
db_name=
"radius"
base_dir=
"/home/backup"
backup_log=
"${base_dir}/mysql_backup.log"
backup_path=
${base_dir}
date=$(date +
"%Y-%m-%d")
filename=
$backup_path/
$db_name-
$date.sql.gz
umask
177
mysqldump --user=
$user --password=
$password --host=
$host $db_name | gzip >
$filename
find
$backup_path/* -mtime +
10 -exec rm {} \;
echo "backup finished at $(date +‘%Y-%m-%d %H:%M:%S‘)" >>
"$backup_log"
参考
版权声明:本文为博主原创文章,未经博主允许不得转载。
[mysql]每日备份shell脚本
标签:数据 shell crontab mysql backup