mysql备份脚本
#!/bin/sh
# The 'd' defines the date.
d=`date +%Y%m%d%H`
# The backup command.
/www/wdlinux/mysql-5.1.55/bin/mysqldump --opt --host=localhost -uroot -p'******' -R --triggers --single-transaction --flush-logs --database bjrun > /backup/mysql/bjrun/bjrun_$d.sql
/bin[img]file:///C:/Users/Administrator/AppData/Local/YNote/data/huichenghui123@163.com/5e91faa815a44abba73a1d01b6139e8b/wid%5Besbifu0o.gif[/img] -a /backup/mysql/bjrun/bjrun_$d.sql /mfs_backup/regrun-mysql/all/
# The 'dt' defines that backup file expiration time.
dt=`date -d "4 day ago" +"%Y%m%d"`
# Delete expired backup files.
rm -rf /backup/mysql/bjrun/bjrun_$dt*.sql
rm -rf /mfs_backup/regrun-mysql/all/bjrun_$dt*.sql