Shell 끝부분에 추가 해주면 로그 파일을 년월일시간형식으로
gz로 압축해 주는 쉘
기존 쉘에 추가부분
if [ -x $USR_HOME/shell/gzlog.sh -o -x $USR_HOME/shell/gzlog.sh ];then
echo "#####XXXR0100J_LOG FILECOPY START#####" >> ${LOG} 2>&1
TRACE_JOB_COMMAND=$USR_HOME/shell/gzlog.sh
$TRACE_JOB_COMMAND /apl/xxx/log/XXXR0100J.log XXXR0100J_LOG
echo "#####XXXR0100J_LOG FILECOPY END#####" >> ${LOG} 2>&1
else
echo "NOT FOUND gzlog.sh !!"
fi
///////////////////////////////////////////////////////////
gzlog.sh 부분
#!/usr/bin/ksh
SAMPLESHHOME=/apl/xxx
LOG=${SAMPLESHHOME}/log/xxxR0100.log
LOG_FILE_NAME=$1
LOG_FILE_DIR=$2
echo "#####設定完了#####" >> ${LOG} 2>&1
FILE_TIME=`date +%y%m%d%H%M%S`.log
echo "FileName 取得" >> ${LOG} 2>&1
#gzip -d /apl/xxx/log/${LOG_FILE_DIR}/${LOG_FILE_DIR}.log.gz
#rm /apl/xxx/log/${LOG_FILE_DIR}/${LOG_FILE_DIR}.log.gz
cp $LOG_FILE_NAME /apl/xxx/log/${LOG_FILE_DIR}/${FILE_TIME}
echo "FileName COPY" >> ${LOG} 2>&1
gzip /apl/xxx/log/${LOG_FILE_DIR}/*.log
echo "File ZIP" >> ${LOG} 2>&1
#rm /apl/xxx/log/${LOG_FILE_DIR}/${FILE_TIME}
exit 0
댓글 없음:
새 댓글을 작성할 수 없습니다.