[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