[shell] 웹호스팅 서버 백업 스크립트 [ 간단버전 ]

#!/bin/sh

#

# Scripted by Myung Lae , CHO (dash)

#

rdate -s time.nuri.net

TODAY=$(date +%Y%m%d)

RMTODAY=$(date +%Y%m%d –date ‘2 days ago’)

echo “IDC Server backup Start(d)” | mail -s “IDC Server Backup Start” alang@clunix.com

#mount /dev/sdb /backup

rm -rf /backup/clunix/$RMTODAY

mkdir /backup/clunix/$TODAY

mkdir /backup/clunix/$TODAY/home

cd /backup/clunix/$TODAY/home

for x in $(ls -l /home|awk ‘{print $9}’)

        do

        tar czfp $x.tar.gz /home/$x/

done

cd /backup/clunix/$TODAY/

tar czfp Etc-$TODAY.tar.gz /etc/

tar czfp Mysql-$TODAY.tar.gz /usr/local/mysql/data/

tar czfp Named-$TODAY.tar.gz /var/named

tar czfp Log-$TODAY.tar.gz /var/log

tar czfp Apache-$TODAY.tar.gz /usr/local/apache/ –exclude=logs

cd ~

#umount /backup

echo “IDC Server Backup Done(d)” | mail -s “IDC Server Backup Done” alang@clunix.com

서진우

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

페이스북/트위트/구글 계정으로 댓글 가능합니다.