#!/bin/bash port=$(nmap -sT localhost | grep ‘domain‘ |awk ‘{print $2}‘) riqi=$(date +"%Y-%m-%d %H:%M") if [ "$port" == "open" ];then echo "$riqi named is ok" >>/home/shell/namedok.txt else /home/wkubuntu/named/sbin/named -c /home/wkubuntu/named/etc/named.conf & sleep 3 /home/wkubuntu/named/sbin/named -c /home/wkubuntu/named/etc/named.conf & echo "$riqi named is restart" >>/home/shell/namederror.txt fi
crontab -e*/1 * * * * /home/shell/jiangkongnamed.sh
时间: 2024-11-10 15:28:07