db_user="oms"
db_passwd="RiX8s$y$"
time="$(date +"%Y%m%d%H%M%S")"
db_name="oms"
db_user_flowable="oms"
db_passwd_flowable="RiX8s$y$"
db_name_flowable="flowable"
# the directory for story your backup file.you shall change this dir
backup_dir="/home/oa/mysql-bak"
# date format for backup file (dd-mm-yyyy)
/usr/local/mysql/bin/mysqldump -h192.168.1.98 -P3306 -u$db_user -p'RiX8s$y$' $db_name --skip-lock-tables > "$backup_dir/$db_name$time.sql"
chmod 777 "$backup_dir/$db_name$time.sql"
# -mtime +7 : n days ago (excluding the N days themselves)
# -mtime 7 : n days ago
/usr/local/mysql/bin/mysqldump -h192.168.1.98 -P3306 -u$db_user_flowable -p'RiX8s$y$' $db_name_flowable --skip-lock-tables > "$backup_dir/$db_name$db_name_flowable$time.sql"
chmod 777 "$backup_dir/$db_name$db_name_flowable$time.sql"
# -mtime +7 : n days ago (excluding the N days themselves)
# -mtime 7 : n days ago
find $backup_dir -name "oms*" -type f -mtime +7 -exec rm {} \; > /dev/null 2>&1
linux mysqldump mysqlbak shell文件
最新推荐文章于 2024-06-27 17:20:43 发布