只是一个完全备份,等增量备份写好了发上来。
假设有三个库
m_site,m_bbs,m_cms.
#!/bin/sh
#
# MySQL Backup Scripts.
# Created by david.
#
# Created time:2008-01-09 11:10:49
#
USERNAME=backup_user
PASSWORD=123456
case "$1" in
m_site) BACKUP_FILE=/home/david_yeung/backup/backup_m_site`date '+%Y%m%d_%H%M%S'`.sql ;;
m_bbs) BACKUP_FILE=/home/david_yeung/backup/backup_m_bbs`date '+%Y%m%d_%H%M%S'`.sql ;;
m_cms) BACKUP_FILE=/home/david_yeung/backup/backup_m_cms`date '+%Y%m%d_%H%M%S'`.sql ;;
*) ;;
esac
# Start backup.
/usr/local/mysql/bin/mysqldump -u$USERNAME -p$PASSWORD -B $1 --add-drop-table -R > $BACKUP_FILE
# Compress backup file.
gzip $BACKUP_FILE
加入到CRONTAB里面去。
[david_yeung]# crontab -l
0 0 * * * /home/david_yeung/mysqlbackup_david m_site
0 0 * * * /home/david_yeung/mysqlbackup_david m_bbs
0 0 * * * /home/david_yeung/mysqlbackup_david m_cms
阅读(4335) | 评论(4) | 转发(0) |