バックアップスクリプト


#! /bin/sh

. /etc/sysconfig/network
BACKUPDIR=/mnt/Backup

ETC=" \
	etc \
	usr/local \
	var/named \
	var/spool/cron \
	"
WWW=" \
	home/httpd \
	"
HOME=" \
	home/yamasita \
	"

cd $BACKUPDIR
#---------------------------------------------------
# rotate
#
for file in \
	$HOSTNAME-etc.tar.gz \
	$HOSTNAME-httpd.tar.gz \
	$HOSTNAME-yamasita.tar.gz \
	$HOSTNAME-rpm-qa.gz \
	$HOSTNAME-chkconfig--list.gz
do
	mv $file.6 $file.7 2>&1 > /dev/null
	mv $file.5 $file.6 2>&1 > /dev/null
	mv $file.4 $file.5 2>&1 > /dev/null
	mv $file.3 $file.4 2>&1 > /dev/null
	mv $file.2 $file.3 2>&1 > /dev/null
	mv $file.1 $file.2 2>&1 > /dev/null
	mv $file   $file.1 2>&1 > /dev/null
done
cd /
# sleep 30

#---------------------------------------------------
FILES=$ETC
GZFILE=$BACKUPDIR/$HOSTNAME-etc.tar.gz
tar cf - $FILES | gzip > $GZFILE
# sleep 120

#---------------------------------------------------
FILES=$WWW
GZFILE=$BACKUPDIR/$HOSTNAME-httpd.tar.gz
tar cf - $FILES | gzip > $GZFILE
# sleep 120

#---------------------------------------------------
FILES=$HOME
GZFILE=$BACKUPDIR/$HOSTNAME-yamasita.tar.gz
tar cf - $FILES | gzip > $GZFILE
# sleep 120

#---------------------------------------------------
GZFILE=$BACKUPDIR/$HOSTNAME-rpm-qa.gz
rpm -qa|sort | gzip > $GZFILE

#---------------------------------------------------
GZFILE=$BACKUPDIR/$HOSTNAME-chkconfig--list.gz
/sbin/chkconfig --list | gzip > $GZFILE

 BUFFALO Link Station をハックしよう
Copyright (C) 2004 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp
山下康成京都府向日市