named 1분 간격으로 검사하여 살리는 스크립트
2012.12.26 22:16
원문 : http://www.ischo.net -- 조인상 // 시스템 엔지니어
Writer : http://www.ischo.net -- ischo // System Engineer in Replubic Of Korea
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
원문 : http://www.ischo.net -- 조인상 //시스템 엔지니어
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/ksh
###########################################################
# script by ischo
# http://www.ischo.net
# chosim1@naver.com
# Shell script : Check named alive & start that if it dead.
###########################################################
TTIME=`date +%H:%M:%S`
DDATE=`date +%Y%m%d`
PROG_HOME=/home/admin/chk_named
LOGFILE=${PROG_HOME}/chk_named.log
DAEMON_NAME=/usr/sbin/named
echo "${DDATE} ${TTIME} SHELL START!" >> ${LOGFILE}
while [ 0 ];
do
NAMED_STATUS=`ps -ef | grep ${DAEMON_NAME} | grep -v grep | wc -l`
if [ ${NAMED_STATUS} -eq 1 ];
then
sleep 60
else
TTIME=`date +%H:%M:%S`
DDATE=`date +%Y%m%d`
stopsrc -s named
sleep 1
startsrc -s named
echo "${DDATE} ${TTIME} named restarted." >> ${LOGFILE}
echo >> ${LOGFILE}
fi
done
응용하면 여러가지 용도로 활용이 가능 할 것 같습니다.