2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $NetBSD: ntpdate,v 1.8 2002/03/22 04:16:39 lukem Exp $
|
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: ntpdate
|
2002-06-13 22:14:37 +00:00
|
|
|
# REQUIRE: NETWORKING syslogd
|
|
|
|
# KEYWORD: FreeBSD NetBSD
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="ntpdate"
|
2002-06-13 22:14:37 +00:00
|
|
|
rcvar=`set_rcvar`
|
|
|
|
|
|
|
|
case `${CMD_OSTYPE}` in
|
|
|
|
FreeBSD)
|
|
|
|
command="/usr/sbin/${name}"
|
|
|
|
command_args=">/dev/null 2>&1"
|
|
|
|
pidfile="/var/run/${name}.pid"
|
|
|
|
;;
|
|
|
|
NetBSD)
|
|
|
|
start_cmd="ntpdate_start"
|
|
|
|
stop_cmd=":"
|
|
|
|
;;
|
|
|
|
esac
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
ntpdate_start()
|
|
|
|
{
|
|
|
|
if [ -z "$ntpdate_hosts" ]; then
|
|
|
|
ntpdate_hosts=`awk '
|
2002-06-13 22:14:37 +00:00
|
|
|
/^server[ \t]*127.127/ {next}
|
|
|
|
/^(server|peer)/ {print $2}
|
2001-06-16 07:16:14 +00:00
|
|
|
' </etc/ntp.conf`
|
|
|
|
fi
|
|
|
|
if [ -n "$ntpdate_hosts" ]; then
|
|
|
|
echo "Setting date via ntp."
|
2002-06-13 22:14:37 +00:00
|
|
|
ntpdate $rc_flags $ntpdate_hosts
|
2001-06-16 07:16:14 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|