下面的代码,在我的服务器上每小时做一次mysql dump会导致意外的文件结束错误,有人可以尝试解释什么是错误的吗?
mysql_host="localhost"
mysql_database="databasename"
mysql_username="databaseusername"
mysql_password="databasepass"
backup_path=/home/backups
expired=3
today=$(date "+%Y-%m-%d")
if [ ! -d $backup_path/"$today" ]
then
mkdir -p $backup_path/$today
else
/usr/bin/mysqldump -h $mysql_host -u $mysql_username -p$mysql_password $mysql_database > $backup_path/$today/$mysql_database-date"+%H%M".sql
fi
# Remove folder which more than 3 days
find $backup_path -type d -mtime +$expired | xargs rm -Rf