#!/usr/bin/openrc-run

. /opt/etc/functions.openrc

PIDFILE="/var/run/ntpd.pid"

depend() {
	need net dns
	provide ntp ${SVCNAME}
}

start()
{
	local _rc=1
	ebegin "Starting \"${SVCNAME}\""
	start-stop-daemon --background --pidfile ${PIDFILE} --make-pidfile \
			--start --exec ntpd -- ${NTPD_ARGS}
	_rc=$?
	eend ${_rc}
	return ${_rc}
}

stop()
{
	ebegin "Stopping service \"${SVCNAME}\""
	start-stop-daemon --stop --exec ntpd --retry SIGTERM/5 --pidfile ${PIDFILE}
	eend 0
	return 0
}
