unix(hp-ux) 7일전 까지 로그백업 쉘 스크립트
2010. 11. 9. 11:27ㆍ99. 정리전 - IT/13. Unix 얇팍지식
#!/bin/sh
#os=`uname -s`
#case ${os} in
# AIX) timezone="KORST+15"
# ;;
# SunOS) timezone="ROK+3"
# ;;
# HP-UX) timezone="KST+15"
# ;;
# Linux) timezone="KST+15"
# ;;
# *) echo "Not support platform..."
# exit 1
# ;;
#esac
#TZ=${timezone}
#export TZ
# webtob log backup
#echo webtob log backup
#tar -cvf /xxx/logs_backup/webtob/webtob_`hostname`_$CURRENT_DATE.tar /app/tmax/webtob/log/*
#rm -rf /app/tmax/webtob/log/*
# jeus5 gc log backup
#echo jeus5 gc log backup
#tar -cvf /xxx/logs_backup/jeus5/gc_`hostname`_$CURRENT_DATE.tar /app/tmax/jeus5/logs/gc/*
#rm -rf /app/tmax/jeus5/logs/gc/*.log
# jeus5 log backup
#echo jeus5 log backup
#tar -cvf /xxx/logs_backup/jeus5/jeus5_`hostname`_$CURRENT_DATE.tar /app/tmax/jeus5/logs/`hostname`/*
#rm -rf /app/tmax/jeus5/logs/`hostname`/*
# lafj log backup
echo lafj log backup
tar -cvf /xxx/logs_backup/lafj/lafj_`hostname`_$DT7BEFORE.tar /app/XXX/logs/$DT7BEFORE*.log
rm -rf /app/XXX/logs/$DT7BEFORE*.log
# xlog backup
echo xlog backup
#rm -rf /app/xlog/logs/XLOG$DT7BEFORE*.xlog
#cd /xxx/logs_backup/webtob
#/usr/contrib/bin/gzip -9f webtob_`hostname`_$CURRENT_DATE.tar
#cd /xxx/logs_backup/jeus5
#/usr/contrib/bin/gzip -9f gc_`hostname`_$CURRENT_DATE.tar
#/usr/contrib/bin/gzip -9f jeus5_`hostname`_$CURRENT_DATE.tar
cd /xxx/logs_backup/lafj
/usr/contrib/bin/gzip -9f lafj_`hostname`_$DT7BEFORE.tar
exit 0
#os=`uname -s`
#case ${os} in
# AIX) timezone="KORST+15"
# ;;
# SunOS) timezone="ROK+3"
# ;;
# HP-UX) timezone="KST+15"
# ;;
# Linux) timezone="KST+15"
# ;;
# *) echo "Not support platform..."
# exit 1
# ;;
#esac
#TZ=${timezone}
#export TZ
CURRENT_DATE=`date +%Y%m%d`
DT7BEFORE=$(perl -e '($year,$mon,$day) = (localtime(time() - (7 * 86400)))[5,4,3]; printf("%04d%02d%02d\n",$year + 1900,$mon + 1,$day)')
DT7BEFORE=$(perl -e '($year,$mon,$day) = (localtime(time() - (7 * 86400)))[5,4,3]; printf("%04d%02d%02d\n",$year + 1900,$mon + 1,$day)')
# webtob log backup
#echo webtob log backup
#tar -cvf /xxx/logs_backup/webtob/webtob_`hostname`_$CURRENT_DATE.tar /app/tmax/webtob/log/*
#rm -rf /app/tmax/webtob/log/*
# jeus5 gc log backup
#echo jeus5 gc log backup
#tar -cvf /xxx/logs_backup/jeus5/gc_`hostname`_$CURRENT_DATE.tar /app/tmax/jeus5/logs/gc/*
#rm -rf /app/tmax/jeus5/logs/gc/*.log
# jeus5 log backup
#echo jeus5 log backup
#tar -cvf /xxx/logs_backup/jeus5/jeus5_`hostname`_$CURRENT_DATE.tar /app/tmax/jeus5/logs/`hostname`/*
#rm -rf /app/tmax/jeus5/logs/`hostname`/*
# lafj log backup
echo lafj log backup
tar -cvf /xxx/logs_backup/lafj/lafj_`hostname`_$DT7BEFORE.tar /app/XXX/logs/$DT7BEFORE*.log
rm -rf /app/XXX/logs/$DT7BEFORE*.log
# xlog backup
echo xlog backup
#rm -rf /app/xlog/logs/XLOG$DT7BEFORE*.xlog
#cd /xxx/logs_backup/webtob
#/usr/contrib/bin/gzip -9f webtob_`hostname`_$CURRENT_DATE.tar
#cd /xxx/logs_backup/jeus5
#/usr/contrib/bin/gzip -9f gc_`hostname`_$CURRENT_DATE.tar
#/usr/contrib/bin/gzip -9f jeus5_`hostname`_$CURRENT_DATE.tar
cd /xxx/logs_backup/lafj
/usr/contrib/bin/gzip -9f lafj_`hostname`_$DT7BEFORE.tar
exit 0