1, the new file and give execute permissions auto_bak_data.sh
touch auto_bak_data.sh
chmod +x auto_bak_data.sh
2, add a backup command
we auto_bak_data.sh
#! / Bin / SH # Note that the variable value of the variable can not have spaces before =
RQ = `DATE the Y% +% m% d` mysqldump -u user_ofo -p root --single-transaction ofo>/tmp/mysql_data_backup/ofo_$rq.sql; find /tmp/mysql_data_backup/ -mtime +7 -name "*.sql" -exec rm -rf {} \;
3, add regular tasks
Before reference Bowen Linux regularly delete the log n days before the 2.3 Scheduled Tasks