반응형
dns2.sh 스크립트
dns2.sh editor
vim /usr/sbin/dns.sh
#!/bin/sh
while true
do
NAMED="/usr/sbin/named"
NAMED2="/usr/sbin/named2"
NAMEDSTART1="/usr/sbin/named
NAMEDSTART2="/usr/sbin/named2 -u named -c /etc/named2.conf"
CHK=`ps -ef |grep $NAMED | grep -v named2 | grep -v grep`
CHK2=`ps -ef |grep $NAMED2 | grep -v grep`
if test -z "$CHK"
then
date >> /var/named/log/dns.txt
ps -ef | grep named >> /var/named/log/dns.txt
$NAMEDSTART1
echo "Restarting NAMED1 Process." >> /var/named/log/dns.txt
ps -ef | grep named >> /var/named/log/dns.txt
netstat -na | grep 53 >> /var/named/log/dns.txt
fi
if test -z "$CHK2"
then
date >> /var/named2/log/dns.txt
ps -ef | grep named >> /var/named2/log/dns.txt
$NAMEDSTART2
echo "Restarting NAMED2 Process." >> /var/named2/log/dns.txt
ps -ef | grep named >> /var/named2/log/dns.txt
netstat -na | grep 54 >> /var/named2/log/dns.txt
fi
sleep 3
done
chmod +x /usr/sbin/dns.sh
728x90
반응형
'스크립트' 카테고리의 다른 글
하이퍼쓰레딩(Hyper Threading) 활성화 상태 확인하는 스크립트 (0) | 2014.06.20 |
---|---|
DSR 루프백 설정하는 방법(dsr loopback 설정) (0) | 2014.03.14 |
dns-check.sh 스크립트 (0) | 2014.03.10 |
DNS(named) 서비스를 모니터링하는 스크립트 (0) | 2014.03.10 |
linux system backup 스크립트 (0) | 2014.03.10 |