每三小时热备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# ll
total 442
drwxr-xr-x  8 root  wheel  512 Mar  1 00:02 2013-03-01_00-01-08
drwxr-xr-x  8 root  wheel  512 Mar  1 03:03 2013-03-01_03-01-26
drwxr-xr-x  8 root  wheel  512 Mar  1 06:02 2013-03-01_06-01-09
drwxr-xr-x  8 root  wheel  512 Mar  1 09:02 2013-03-01_09-01-14
drwxr-xr-x  8 root  wheel  512 Mar  1 12:02 2013-03-01_12-01-20
drwxr-xr-x  8 root  wheel  512 Mar  1 15:02 2013-03-01_15-01-23
drwxr-xr-x  8 root  wheel  512 Mar  1 18:02 2013-03-01_18-01-21
drwxr-xr-x  8 root  wheel  512 Mar  1 21:02 2013-03-01_21-01-21
drwxr-xr-x  8 root  wheel  512 Mar  2 00:03 2013-03-02_00-01-22
drwxr-xr-x  8 root  wheel  512 Mar  2 03:03 2013-03-02_03-01-24
drwxr-xr-x  8 root  wheel  512 Mar  2 06:02 2013-03-02_06-01-10
drwxr-xr-x  8 root  wheel  512 Mar  2 09:03 2013-03-02_09-01-23
drwxr-xr-x  8 root  wheel  512 Mar  2 12:02 2013-03-02_12-01-19
drwxr-xr-x  8 root  wheel  512 Mar  2 15:02 2013-03-02_15-01-17
drwxr-xr-x  8 root  wheel  512 Mar  2 18:02 2013-03-02_18-01-13
drwxr-xr-x  8 root  wheel  512 Mar  2 21:03 2013-03-02_21-01-16
drwxr-xr-x  8 root  wheel  512 Mar  3 00:02 2013-03-03_00-01-14
drwxr-xr-x  8 root  wheel  512 Mar  3 03:03 2013-03-03_03-01-26
drwxr-xr-x  8 root  wheel  512 Mar  3 06:02 2013-03-03_06-01-09
drwxr-xr-x  8 root  wheel  512 Mar  3 09:02 2013-03-03_09-01-18
drwxr-xr-x  8 root  wheel  512 Mar  3 12:02 2013-03-03_12-01-12
drwxr-xr-x  8 root  wheel  512 Mar  3 15:02 2013-03-03_15-01-19
drwxr-xr-x  8 root  wheel  512 Mar  3 18:02 2013-03-03_18-01-21
drwxr-xr-x  8 root  wheel  512 Mar  3 21:03 2013-03-03_21-01-23
drwxr-xr-x  8 root  wheel  512 Mar  4 00:02 2013-03-04_00-01-21
drwxr-xr-x  8 root  wheel  512 Mar  4 03:03 2013-03-04_03-01-24
drwxr-xr-x  8 root  wheel  512 Mar  4 06:02 2013-03-04_06-01-09
drwxr-xr-x  8 root  wheel  512 Mar  4 09:02 2013-03-04_09-01-16
drwxr-xr-x  8 root  wheel  512 Mar  4 12:02 2013-03-04_12-01-12
drwxr-xr-x  8 root  wheel  512 Mar  4 15:02 2013-03-04_15-01-22
drwxr-xr-x  8 root  wheel  512 Mar  4 18:02 2013-03-04_18-01-23
drwxr-xr-x  8 root  wheel  512 Mar  4 21:02 2013-03-04_21-01-23
drwxr-xr-x  8 root  wheel  512 Mar  5 00:02 2013-03-05_00-01-22
drwxr-xr-x  8 root  wheel  512 Mar  5 03:03 2013-03-05_03-01-27
drwxr-xr-x  8 root  wheel  512 Mar  5 06:02 2013-03-05_06-01-11
drwxr-xr-x  8 root  wheel  512 Mar  5 09:02 2013-03-05_09-01-25
drwxr-xr-x  8 root  wheel  512 Mar  5 12:02 2013-03-05_12-01-23
drwxr-xr-x  8 root  wheel  512 Mar  5 15:02 2013-03-05_15-01-23
drwxr-xr-x  8 root  wheel  512 Mar  5 18:02 2013-03-05_18-01-25
drwxr-xr-x  8 root  wheel  512 Mar  5 21:02 2013-03-05_21-01-22
drwxr-xr-x  8 root  wheel  512 Mar  6 00:03 2013-03-06_00-01-26
drwxr-xr-x  8 root  wheel  512 Mar  6 03:03 2013-03-06_03-01-26
drwxr-xr-x  8 root  wheel  512 Mar  6 06:02 2013-03-06_06-01-09
drwxr-xr-x  8 root  wheel  512 Mar  6 09:03 2013-03-06_09-01-23
drwxr-xr-x  8 root  wheel  512 Mar  6 12:03 2013-03-06_12-01-24

...................................................................................................................

 

你可能感兴趣的:(shell脚本)