crontab -e
0 3 * * * sh /home/shell/mysql_bakup.sh >> /dev/null 2>&1
#!/bin/bash
/usr/local/mysql/bin/mysqldump -uroot -pmingquan0211 --all-databases --routines --events --triggers | gzip > /home/shell/mysql_bakup/mysql_bakup_`date '+%Y-%m-%d'`.sql.gz
find /home/shell/mysql_bakup -mtime +30 -name "*.gz" -exec rm -rf {} \;