#!/sbin/runscript # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/files/ntpd-4.1.1b.rc,v 1.1 2003/08/06 07:42:24 vapier Exp $ depend() { need net use dns logger } checkconfig() { if [ ! -f /etc/ntp.conf ] ; then eerror "Please create /etc/ntp.conf" eerror "Sample conf: /usr/share/ntp/ntp.conf" return 1 fi return 0 } start() { checkconfig || return $? if [ -n "${NTPDATE_CMD}" ] ; then ebegin "Initializing clock via ${NTPDATE_CMD}" ${NTPDATE_CMD} ${NTPDATE_OPTS} > /dev/null eend $? "Failed to run ${NTPDATE_CMD}" elif [ "${NTPDATE_WARN}" == "y" ] ; then ewarn "Please setup ntpd via /etc/conf.d/ntpd" fi ebegin "Starting ntpd" start-stop-daemon --start --quiet --pidfile /var/run/ntpd.pid \ --startas /usr/bin/ntpd -- -p /var/run/ntpd.pid ${NTPD_OPTS} eend $? "Failed to start ntpd" } stop() { ebegin "Stopping ntpd" start-stop-daemon --stop --quiet --pidfile /var/run/ntpd.pid eend $? "Failed to stop ntpd" # clean stale pidfile [ -f /var/run/ntpd.pid ] && rm -f /var/run/ntpd.pid }