首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 冲浪宝典 > 冲浪技巧 > 备份部分脚本(未尝试)
【标  题】:备份部分脚本(未尝试)
【关键字】:
【来  源】:http://www.cublog.cn/u/1453/showart.php?id=125591

备份部分脚本(未尝试)



#!/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


关于备份的部分文档:【上一篇】
积攒点滴:【下一篇】
【相关文章】
没有相关文章
【随机文章】
  • [Tp link]使用端口映射实现内网web服务器
  • 二十八条改善 ASP 性能和外观的技巧(1-7)
  • 2004年中国计算机软件专业技术资格和水平考试官方简介
  • 在Java中实现Job Scheduling
  • 病毒名称 I-Worm/Sober.j
  • 解决source navgator的中文显示问题
  • 体验Google Finance
  • 用vb使用对话框资源创建对话框
  • Samba服务器的设置
  • 比较几种常用的中间件产品的通信机制(基于TCP/IP)
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.