RE: NetReg: What is Latest Version of refresh-dhcpdconf?

New Message Reply Date view Thread view Subject view Author view Attachment view

From: King, Michael (MKing@bridgew.edu)
Date: Fri Aug 29 2003 - 18:54:21 CDT


This is what I'm running, 1.3 with CIDR.

I added the extralines to copy dhcpd.conf.bak to dhcpd.conf.new, so that it
wouldn't still have the error in .new. That way, registrations after the
server came backup wouldn't keep taking it down.

There was a better version of refresh-dhcpdconf put on the mailing list, I
just never copied it.

Mike

#!/bin/bash

# refresh-dhcpdconf for Netreg
# Belongs at /usr/local/bin/refresh-dhcpdconf

if [ /etc/dhcpd/dhcpd.conf.new -nt /etc/dhcpd/dhcpd.conf ]; then
  echo "dhcpd.conf.new is newer than dhcpd.conf...Copying dhcpd.conf to
dhcpd.conf.bak"
  cp /etc/dhcpd/dhcpd.conf /etc/dhcpd/dhcpd.conf.bak
  echo "Copying dhcpd.conf.new to dhcpd.conf"
  cp /etc/dhcpd/dhcpd.conf.new /etc/dhcpd/dhcpd.conf
  echo "Reloading the server..."
  /usr/sbin/dhcpdctl stop
  sleep 1
  /usr/sbin/dhcpdctl start
  if [ "`ps aux|grep dhcpd|grep -v grep|awk '{print $2}'`" != "`cat
/var/run/dhcpd.pid`" ]; then
    echo "Server start failed...copying .conf to .conf.bad"
    cp /etc/dhcpd/dhcpd.conf /etc/dhcpd/dhcpd.conf.bad
    echo "Copying dhcpd.conf.bak to dhcpd.conf.new"
    cp /etc/dhcpd/dhcpd.conf.bak /etc/dhcpd/dhcpd.conf.new
    echo "Copying dhcpd.conf.bak to dhcpd.conf"
    cp /etc/dhcpd/dhcpd.conf.bak /etc/dhcpd/dhcpd.conf
    echo "Trying to start the server..."
    /usr/sbin/dhcpdctl start
    if [ "`ps aux|grep dhcpd|grep -v grep|awk '{print $2}'`" != "`cat
/var/run/dhcpd.pid`" ]; then
      echo "Fatal Error: Server could not start."
    fi
  fi
fi

-----Original Message-----
From: Steve Hess [mailto:shess@wheatonma.edu]
Sent: Friday, August 29, 2003 6:23 PM
To: netreg@southwestern.edu
Subject: NetReg: What is Latest Version of refresh-dhcpdconf?

# refresh-dhcpdconf for Netreg
# Belongs at /usr/local/bin/refresh-dhcpdconf

if [ /etc/dhcpd/dhcpd.conf.new -nt /etc/dhcpd/dhcpd.conf ]; then
  echo "dhcpd.conf.new is newer than dhcpd.conf...Copying dhcpd.conf to
dhcpd.conf.bak"
  cp /etc/dhcpd/dhcpd.conf /etc/dhcpd/dhcpd.conf.bak
  echo "Copying dhcpd.conf.new to dhcpd.conf"
  cp /etc/dhcpd/dhcpd.conf.new /etc/dhcpd/dhcpd.conf
  echo "Reloading the server..."
  /usr/sbin/dhcpdctl stop
  sleep 1
  /usr/sbin/dhcpdctl start
  if [ "`ps aux|grep dhcpd|grep -v grep|awk '{print $2}'`" !
= "`cat /var/run/dhcpd.pid`" ]; then
    echo "Server start failed...copying .conf to .conf.bad"
    cp /etc/dhcpd/dhcpd.conf /etc/dhcpd/dhcpd.conf.bad
    echo "Copying dhcpd.conf.bak to dhcpd.conf"
    cp /etc/dhcpd/dhcpd.conf.bak /etc/dhcpd/dhcpd.conf
    echo "Trying to start the server..."
    /usr/sbin/dhcpdctl start
    if [ "`ps aux|grep dhcpd|grep -v grep|awk '{print $2}'`" ! = "`cat
/var/run/dhcpd.pid`" ]; then
      echo "Fatal Error: Server could not start."
    fi
  fi
fi

**********************************************************************
To unsubscribe from this list, send an e-mail message to
majordomo@southwestern.edu containing a single line with the words:
unsubscribe netreg Send requests for assistance to:
owner-netreg@southwestern.edu
**********************************************************************
**********************************************************************
To unsubscribe from this list, send an e-mail message to
majordomo@southwestern.edu containing a single line with the words:
unsubscribe netreg
Send requests for assistance to: owner-netreg@southwestern.edu
**********************************************************************


New Message Reply Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.4 : Thu Aug 12 2004 - 12:01:40 CDT