每三小時熱備shell指令檔 mysql1# cat mysqlbackup.sh#!/usr/local/bin/fish#備份策略為每天全備#設定備份路徑變數set backupdir /usr/db/backup#產生備份目錄mkdir -p $backupdir#刪除備份時間超過一個月的備份find $backupdir/ -mtime +30 -type d -delete#開始備份innobackupex --user=root --password='yUe5bkgOf$' --parallel=12 $backupdir/mysql1# cd /usr/db/backup/mysql1#mysql1# lltotal 442drwxr-xr-x 8 root wheel 512 Mar 1 00:02 2013-03-01_00-01-08drwxr-xr-x 8 root wheel 512 Mar 1 03:03 2013-03-01_03-01-26drwxr-xr-x 8 root wheel 512 Mar 1 06:02 2013-03-01_06-01-09drwxr-xr-x 8 root wheel 512 Mar 1 09:02 2013-03-01_09-01-14drwxr-xr-x 8 root wheel 512 Mar 1 12:02 2013-03-01_12-01-20drwxr-xr-x 8 root wheel 512 Mar 1 15:02 2013-03-01_15-01-23drwxr-xr-x 8 root wheel 512 Mar 1 18:02 2013-03-01_18-01-21drwxr-xr-x 8 root wheel 512 Mar 1 21:02 2013-03-01_21-01-21drwxr-xr-x 8 root wheel 512 Mar 2 00:03 2013-03-02_00-01-22drwxr-xr-x 8 root wheel 512 Mar 2 03:03 2013-03-02_03-01-24drwxr-xr-x 8 root wheel 512 Mar 2 06:02 2013-03-02_06-01-10drwxr-xr-x 8 root wheel 512 Mar 2 09:03 2013-03-02_09-01-23drwxr-xr-x 8 root wheel 512 Mar 2 12:02 2013-03-02_12-01-19drwxr-xr-x 8 root wheel 512 Mar 2 15:02 2013-03-02_15-01-17drwxr-xr-x 8 root wheel 512 Mar 2 18:02 2013-03-02_18-01-13drwxr-xr-x 8 root wheel 512 Mar 2 21:03 2013-03-02_21-01-16drwxr-xr-x 8 root wheel 512 Mar 3 00:02 2013-03-03_00-01-14drwxr-xr-x 8 root wheel 512 Mar 3 03:03 2013-03-03_03-01-26drwxr-xr-x 8 root wheel 512 Mar 3 06:02 2013-03-03_06-01-09drwxr-xr-x 8 root wheel 512 Mar 3 09:02 2013-03-03_09-01-18drwxr-xr-x 8 root wheel 512 Mar 3 12:02 2013-03-03_12-01-12drwxr-xr-x 8 root wheel 512 Mar 3 15:02 2013-03-03_15-01-19drwxr-xr-x 8 root wheel 512 Mar 3 18:02 2013-03-03_18-01-21drwxr-xr-x 8 root wheel 512 Mar 3 21:03 2013-03-03_21-01-23drwxr-xr-x 8 root wheel 512 Mar 4 00:02 2013-03-04_00-01-21drwxr-xr-x 8 root wheel 512 Mar 4 03:03 2013-03-04_03-01-24drwxr-xr-x 8 root wheel 512 Mar 4 06:02 2013-03-04_06-01-09drwxr-xr-x 8 root wheel 512 Mar 4 09:02 2013-03-04_09-01-16drwxr-xr-x 8 root wheel 512 Mar 4 12:02 2013-03-04_12-01-12drwxr-xr-x 8 root wheel 512 Mar 4 15:02 2013-03-04_15-01-22drwxr-xr-x 8 root wheel 512 Mar 4 18:02 2013-03-04_18-01-23drwxr-xr-x 8 root wheel 512 Mar 4 21:02 2013-03-04_21-01-23drwxr-xr-x 8 root wheel 512 Mar 5 00:02 2013-03-05_00-01-22drwxr-xr-x 8 root wheel 512 Mar 5 03:03 2013-03-05_03-01-27drwxr-xr-x 8 root wheel 512 Mar 5 06:02 2013-03-05_06-01-11drwxr-xr-x 8 root wheel 512 Mar 5 09:02 2013-03-05_09-01-25drwxr-xr-x 8 root wheel 512 Mar 5 12:02 2013-03-05_12-01-23drwxr-xr-x 8 root wheel 512 Mar 5 15:02 2013-03-05_15-01-23drwxr-xr-x 8 root wheel 512 Mar 5 18:02 2013-03-05_18-01-25drwxr-xr-x 8 root wheel 512 Mar 5 21:02 2013-03-05_21-01-22drwxr-xr-x 8 root wheel 512 Mar 6 00:03 2013-03-06_00-01-26drwxr-xr-x 8 root wheel 512 Mar 6 03:03 2013-03-06_03-01-26drwxr-xr-x 8 root wheel 512 Mar 6 06:02 2013-03-06_06-01-09drwxr-xr-x 8 root wheel 512 Mar 6 09:03 2013-03-06_09-01-23drwxr-xr-x 8 root wheel 512 Mar 6 12:03 2013-03-06_12-01-24...........................................................