monitoring and restarting bind

Waltner, Steve swaltner at lsil.com
Thu Aug 9 15:44:51 UTC 2001


What version of Solaris are your running? What error messages are you
getting? Where did you install your copy of BIND? Without basic info like
this, we can't really help debug the problem. My gut feeling is that you are
running Solaris 2.6 or earlier, which don't include the pgrep command. But
since you didn't include the error message, that's just a WAG.

Steve

> Hi all,
> I'm kind of a newbie at scripting...  I got the following script of Sun's
> site, but I can't get it to work.  Can anyone find out why?  Or rewrite it
> in Bourne?  Or otherwise get it to work?  Here's the URL I got it from and
> the script itself.
> Thanks in advance.
> 
> http://www.sun.com/bigadmin/scripts/index.html
> (under "monitoring" there's a dns_mon, which is the script below)
> 
> --------------------------------------------------------------------------
> --
> -----
> 
> #!/usr/bin/ksh
> 
> ########################################################
> #
> # Checks for named and starts it if neccessary
> # and notifies of actions taken. Execute from cron.
> #
> # Date: 04/19/2001     Author: Farzad Hejazi
> #
> ########################################################
> 
> NAMED=/usr/local/sbin/named
> HOST=`uname -n`
> PID=`pgrep -U root -G other named`
> EMAILADDR="sysadmin at someaddress.com"
> BADMSG="Named was detected DOWN on $HOST and could not be started!\nPlease
> login and start it manually."
> GOODMSG="Named was detected down on $HOST. It has been successfully
> started.\n"
> SLEEPTIME=10
> 
> if [ "$PID" != "" ]; then
>         exit 0
> else
>         $NAMED -u root -g other
>         sleep $SLEEPTIME
>         PID=`pgrep -U root -G other named`
> 
>         if [ "$PID" != "" ]; then
>                 echo $GOODMSG | mailx -s "DNS Started on $HOST" $EMAILADDR
>                 exit 0
>         else
>                 echo $BADMSG | mailx -s "DNS is DOWN on $HOST" $EMAILADDR
>                 exit 1
>         fi
> fi
> 
> 
> 
> 




More information about the bind-users mailing list