NFS를 이용한 백업스크립트

2010.05.11 10:46

조인상 조회 수:14803

원문 : http://www.ischo.net -- 조인상 // 시스템 엔지니어

Writer : http://www.ischo.net -- ischo // System Engineer in Replubic Of Korea

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

본문 : http://www.ischo.net -- 조인상 //시스템 엔지니어

+++++++++++++++++++++++++++++++++++++++++++++++++++++++


제목 : 사이트에서 NFS를 이용한 백업스크립트

서버 : IBM AIX


백업대상디렉토리는 /nasbackup
로그대상파일은 /backup/naslog/요일명.log



#!/bin/ksh

## NFS NASbackup script
## script by Cho in-sang  (C)SAY info tech.
## 2006.08.09
## edited by 2006.09.11


## backup environment

export LANG=C
LOGFILE=`date | awk '{ print $1 }'`.log
export LOG="/backup/naslog/"$LOGFILE

umount /nasbackup


## backup log start
echo "backup start" > $LOG
date >> $LOG


## export backup


echo "exp backup start" >> $LOG
date >> $LOG

umount /nasbackup
mount -v nfs -o rw,bg,soft nas:/backup /nasbackup

rm -rf /nasbackup/p630/exp/*
tar cf - /data/exp | split -b 2048m - /nasbackup/p630/exp >> $LOG

echo "exp backup end" >> $LOG
date >> $LOG

umount /nasbackup



## oracle hotbackup
umount /nasbackup
mount -v nfs -o rw,bg,soft nas:/backup /nasbackup

echo "oracle hotbackup start" >> $LOG
date >> $LOG

umount /nasbackup

## archived log backup
umount /nasbackup
mount -v nfs -o rw,bg,soft nas:/backup /nasbackup

echo "oracle archivedlog backup start" >> $LOG
date >> $LOG

rm -rf /nasbackup/p630/arch/ora*
(cd /backup/arch;tar cf - .)|(cd /nasbackup/p630/arch;tar xf -) >> $LOG

echo "oracle archivedlog backup end" >> $LOG
date >> $LOG

umount /nasbackup



## /tms backup
umount /nasbackup
mount -v nfs -o rw,bg,soft nas:/backup /nasbackup


echo " /tms backup start" >> $LOG
date >> $LOG

find /tms -print | cpio -pdmv /nasbackup/p630 >> $LOG

echo " /tms backup end" >> $LOG
date >> $LOG

umount /nasbackup


## backup log end
echo " backup complete" >> $LOG
date >> $LOG



## backup script end
서버에 요청 중입니다. 잠시만 기다려 주십시오...