Menu

[r2093]: / trunk / etc / rc.d / msntp  Maximize  Restore  History

Download this file

47 lines (36 with data), 988 Bytes

#!/bin/sh
# Copyright (c) 2007 Volker Theile (votdev@gmx.de)
# All rights reserved.

# PROVIDE: msntp
# REQUIRE: DAEMON
# XQUERY: -i "count(//system/ntp/enable) > 0" -o "0" -b
# RCVAR: msntp

. /etc/rc.subr
. /etc/configxml.subr

name="msntp"
rcvar=`set_rcvar`

# Custom commands
start_precmd="start_precmd"
stop_postcmd="stop_postcmd"

# Defaults
msntp_enable="${msntp_enable:=NO}"
pidfile="/var/run/${name}.pid"
command="/usr/local/bin/${name}"
command_args="-r -P no -l ${pidfile} -x"

start_precmd()
{
	local _cmdarg

	# Get additional command arguments from config file.
	_cmdarg=`/usr/local/bin/xml sel -t \
		-v "concat(//system/ntp/updateinterval,' ',//system/ntp/timeservers)" \
		${configxml_file} | /usr/local/bin/xml unesc`

	# Add additional arguments and set '&' to run in background.
	command_args="${command_args} ${_cmdarg} &"
}

stop_postcmd()
{
	# Remove 'pidfile' because this is not done automatically.
	rm -f ${pidfile}
}

load_rc_config ${name}
run_rc_command "$1"
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.