征求各种备份脚本

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
头像
gnix_oag
帖子: 1994
注册时间: 2005-05-19 18:38
来自: 湖南永州
联系:

征求各种备份脚本

#1

帖子 gnix_oag » 2005-08-03 23:36

完全备份,增量备份,差分备份
头像
yonsan
帖子: 887
注册时间: 2005-07-01 18:56
来自: 广州市

#2

帖子 yonsan » 2005-08-03 23:58

探讨一下:
系统中哪些文件或文件夹必须备份?
I will be back!
头像
gnix_oag
帖子: 1994
注册时间: 2005-05-19 18:38
来自: 湖南永州
联系:

#3

帖子 gnix_oag » 2005-08-04 9:48

下面提供了一个简单的脚本文件来作为一个同时实现完全和差分备份的自动化模型。在使用该脚本以前,请注意检查脚本头定义的环境变量以满足自己的需要。

  #!/bin/sh
  #
  #######################################
  #
  # TAR backup script to cover daily and weekly backups on one tape.
  # Generic UNIX version - edit variables as required
  #
  # For this to work, it MUST be started on a Monday!
  #
  # Copyright (c) 1999, Tim Jones
  # Permission granted for use/modification
  #
  # Tim Jones/Linux Magazine provide this shell script with no warranty
  # (implied or otherwise)
  #
  ########################################

  DOW=`date +%w`
  DATE=`date +%D`
  DAY=`date +%A`
  DEVICE="MY REWIND TAPE" # Rewinding tape drive
  NDEVICE="MY NO_REWIND TAPE" # non-rewinding tape drive
  REWIND="mt -f $DEVICE rewind"
  EOD="mt -f $NDEVICE eod"
  FSF="mt -f $NDEVICE fsf"
  MAILLIST="root" # list of users to receive backup notice

  if [ $DOW = "6" ]
  then
  # This is Saturday, so append and write the whole system!
  $EOD
  echo $DATE > /tmp/.LASTFULL
  tar -cvvf $NDEVICE / >/tmp/backup.txt
  $REWIND
  $FSF 5
  tar -dvf $NDEVICE >> /tmp/backup.txt
  $REWIND
  cp /tmp/.LASTFULL /etc/.LASTFULL
  else
  # this is not Saturday
  case $DOW in
  0)
  # it's Sunday - nothing to do
  exit 0
  ;;
  1)
  # Monday, Let the tape rewind for the difference verification
  echo $DATE > /tmp/.LASTINC
  tar -cvvf $DEVICE --newer `cat /etc/.LASTFULL` / >/tmp/backup.txt
  cp /tmp/.LASTINC /etc/.LASTINC
  ;;
  *)
  # Other Days, must rewind manually and Inspect, -i
  $EOD
  echo $DATE >/tmp/.LASTINC
  tar -cvvf $NDEVICE --newer `cat /etc/.LASTINC` / >/tmp/backup
  $REWIND
  $FSF `expr $DOW - 1`
  echo "************ Verifying ${DAY}'s backup" >> /tmp/backup.txt
  tar --dvf $NDEVICE >> /tmp/backup.txt
  cp /tmp/.LASTINC /etc/.LASTINC
  $REWIND
  esac
  fi
  mail $MAILLIST < /tmp/backup.txt
  rm -f /tmp/backup.txt
  # END OF SCRIPT
头像
gnix_oag
帖子: 1994
注册时间: 2005-05-19 18:38
来自: 湖南永州
联系:

#4

帖子 gnix_oag » 2005-08-04 9:49

谁把它说明一下
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#5

帖子 eexpress » 2005-09-17 22:30

你自己的帖子,要谁说,应该你自己说。加注释吗。
● 鸣学
头像
gnix_oag
帖子: 1994
注册时间: 2005-05-19 18:38
来自: 湖南永州
联系:

#6

帖子 gnix_oag » 2005-09-17 22:48

就是 加中文注释啊

我看不懂啊
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#7

帖子 eexpress » 2005-09-17 23:01

还准备注释的。看到 tape drive ,我就觉得离我远了。
● 鸣学
头像
leal
帖子: 1119
注册时间: 2005-08-29 14:49
来自: 杭州
联系:

#8

帖子 leal » 2005-09-17 23:26

eexpress 写了:还准备注释的。看到 tape drive ,我就觉得离我远了。
那就把tape driver改成磁盘另一个目标区嘛 :)
用心×恒 | 豆瓣 | 门户 | Blog
头像
id_sonic
帖子: 339
注册时间: 2005-04-08 18:08
来自: Chongqing
联系:

#9

帖子 id_sonic » 2006-01-04 14:49

eexpress 写了:还准备注释的。看到 tape drive ,我就觉得离我远了。
我只有那种 随身的 tape ……
目前是 tinkpad r400 上的 debian 用户
my blog Trust Dating
回复