Chinaunix首页 | 论坛 | 博客
  • 博客访问: 388779
  • 博文数量: 166
  • 博客积分: 1972
  • 博客等级: 上尉
  • 技术积分: 1845
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-19 21:16
文章分类

全部博文(166)

文章存档

2013年(7)

2010年(159)

分类:

2010-10-12 16:07:09

  • [root@ytest ~]# crontab -l
  • #0 2 * * * /root/script/mysql1.sh
  • #30 13 * * * /root/script/mysql2.sh
  • [root@ytest ~]# cat /root/script/mysql1.sh
  • #!/bin/sh
  • cd /root/bak/db
  • /usr/local/mysql/bin/mysqldump member > /root/bak/db/member.`date +%Y-%m-%d`-1.sql
  • /usr/local/mysql/bin/mysqldump yoohouse_alpha > /root/bak/db/yoohouse_alpha.`date +%Y-%m-%d`-1.sql
  • /usr/local/mysql/bin/mysqldump yoohouse_estate > /root/bak/db/yoohouse_estate.`date +%Y-%m-%d`-1.sql
  • [root@ytest ~]# cat /root/script/mysql2.sh
  • #!/bin/sh
  • cd /root/bak/db
  • /usr/local/mysql/bin/mysqldump member > /root/bak/db/member.`date +%Y-%m-%d`-2.sql
  • /usr/local/mysql/bin/mysqldump yoohouse_alpha > /root/bak/db/yoohouse_alpha.`date +%Y-%m-%d`-2.sql
  • /usr/local/mysql/bin/mysqldump yoohouse_estate > /root/bak/db/yoohouse_estate.`date +%Y-%m-%d`-2.sql
  • 并删除以往相关备份
  • [root@ytest db]# pwd
  • /root/bak/db
  • [root@ytest db]# for i in 01 02 03 04 05 06 07 08 09 ;do rm -rf yoohouse_estate.2010-10-$i-*.sql ;done
  • [root@ytest db]# for i in 01 02 03 04 05 06 07 08 09 ;do rm -rf yoohouse_alpha.2010-10-$i-*.sql ;done
  • [root@ytest db]# for i in 01 02 03 04 05 06 07 08 09 ;do rm -rf member.2010-10-$i-*.sql ;done
  • [root@ytest data]# rm -rf /data/root_bak_09292010/ #删除以前备份 挪过这 故删除
  •  
  • 阅读(423) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~