This fixes ntp to use leap seconds and keep it updated

needs fcron

./configure --prefix=/usr \
    --bindir=/usr/sbin \
    --sysconfdir=/etc \
    --enable-linuxcaps \
    --with-lineeditlibs=readline \
    --docdir=/usr/share/doc/%{name}-%{version}

cat > /etc/rc.d.init.d/ntpd <<- EOF

    #!/bin/sh
#=================================================================
    # Begin ntpd
    #
    # Description : Daemon handle NTP protocol and keep clock in sync
    #
#=================================================================

    ### BEGIN INIT INFO
    # Provides:            $ntpd
    # Required-Start:      $network
    # Should-Start:
    # Required-Stop:
    # Should-Stop:
    # Default-Start:       3 4 5
    # Default-Stop:        0 1 2 6
    # Short-Description:   Starts ntpd.
    # Description:         Starts ntpd daemon.
    # X-LFS-Provided-By:   BLFS
    ### END INIT INFO

    . /lib/lsb/init-functions

    PROG="ntpd"
    LEAPFILE="/etc/ntp.leapseconds"
    BIN_FILE="/usr/bin/$PROG"
    PID_FILE=/var/run/$PROG.pid

    case "$1" in

        start)
              #to update leap file if needed
              if [ ! -f $LEAPFILE ] ; then
                (
                    cd /tmp
                    log_info_msg "Loading IETF 'seconds leap' file"
                    wget --quiet --timeout=5 http://www.ietf.org/timezones/data/leap-seconds.list
                    evaluate_retval
                    if [ -f leap-seconds.list ] ; then
                          mv leap-seconds.list $LEAPFILE
                    fi
                )
            fi
            #to sync the clock quickly
            log_info_msg "Starting $PROG..."
            start_daemon ${BIN_FILE} -G
            evaluate_retval
            ;;
    stop)

                log_info_msg "Stopping $PROG..."
                killproc -p $PID_FILE ${BIN_FILE}
                evaluate_retval
                ;;
    restart)
            $0 stop
            sleep 1
            $0 start
            ;;
    status)
            statusproc ${BIN_FILE}
            ;;
           *)
                  echo "Usage: $0 {start|stop|restart|status}"
                  exit 1
                  ;;
    esac
    # End /etc/init.d/ntpd

EOF

cat > /etc/cron.monthly/ntpd-leap.cron <<- EOF

    #! /bin/sh
    #-----------------------------------------------
    #to update (each month) the leapfile
    #-----------------------------------------------
    /usr/bin/update-leap -C /etc/ssl

EOF

--
http://lists.linuxfromscratch.org/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to