Scripts for native execution

This commit is contained in:
2016-04-03 12:43:04 +02:00
parent 4e93e3da17
commit 5fe738d662
5 changed files with 90 additions and 81 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ suitable location and copy ntpa.stat.conf from example to
On FreeBSD copy content of bin to /usr/local/ntpa/
Copy example/ntpa.stat.conf to /usr/local/etc/ntpa/ntpa.conf
Copy script/ntpa to /usr/local/etc/rc.d/ntpa
Copy script/ntpa.rc to /usr/local/etc/rc.d/ntpa
Touch /var/log/ntpa.log and adjust pid file location if needed.
Regular → Executable
+1 -80
View File
@@ -1,82 +1,3 @@
#!/bin/sh
#
# $FreeBSD
#
# PROVIDE: ntpa
# REQUIRE: networking
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable ntpa:
# ntpa_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable ntpa
# ntpa_config (file): Set to "/usr/local/etc/ntpa/ntpa.conf" by default.
# ntpa_tempdir (path): Set to "/tmp/" by default.
#
# Run additional instances of ntpa with:
# Use ln -s ntpa ntpa_graph
#
. /etc/rc.subr
name="$0"
name="${name##*/}"
rcvar=${name}_enable
start_cmd="ntpa_start"
stop_cmd="ntpa_stop"
reload_cmd="ntpa_reload"
extra_commands="reload"
load_rc_config ${name}
MONO="/usr/local/bin/mono"
ntpa_start()
{
if [ -f ${pidfile} ]; then
rc_pid=`cat ${pidfile}`
echo 1>&2 "${name} already running? (pid=$rc_pid)."
return 1
else
echo "Starting ${name}."
cd /usr/local/ntpa/
${MONO} ntpa.exe --config ${config} --writepid ${pidfile} --temp ${tempdir} --daemon ${name} &
fi
}
ntpa_reload()
{
if [ ! -f ${pidfile} ]; then
_run_rc_notrunning
return 1
else
echo "Reloading ${name}."
rc_pid=`cat ${pidfile}`
kill -USR1 $rc_pid
fi
}
ntpa_stop()
{
if [ ! -f ${pidfile} ]; then
_run_rc_notrunning
return 1
else
echo "Stopping ${name}."
rc_pid=`cat ${pidfile}`
kill -TERM $rc_pid
wait_for_pids ${rc_pid}
fi
}
eval ": \${${name}_enable:=\"NO\"}"
eval ": \${${name}_config:=\"/usr/local/etc/ntpa/${name}.conf\"}"
eval ": \${${name}_tempdir:=\"/tmp/\"}"
config="$(eval echo \${${name}_config})"
tempdir="$(eval echo \${${name}_tempdir})"
pidfile="/var/run/${name}.pid"
run_rc_command "$1"
exec mono "/usr/local/ntpa/ntpa.exe" "$@"
Executable
+82
View File
@@ -0,0 +1,82 @@
#!/bin/sh
#
# $FreeBSD
#
# PROVIDE: ntpa
# REQUIRE: networking
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable ntpa:
# ntpa_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable ntpa
# ntpa_config (file): Set to "/usr/local/etc/ntpa/ntpa.conf" by default.
# ntpa_tempdir (path): Set to "/tmp/" by default.
#
# Run additional instances of ntpa with:
# Use ln -s ntpa ntpa_graph
#
. /etc/rc.subr
name="$0"
name="${name##*/}"
rcvar=${name}_enable
start_cmd="ntpa_start"
stop_cmd="ntpa_stop"
reload_cmd="ntpa_reload"
extra_commands="reload"
load_rc_config ${name}
MONO="/usr/local/bin/mono"
ntpa_start()
{
if [ -f ${pidfile} ]; then
rc_pid=`cat ${pidfile}`
echo 1>&2 "${name} already running? (pid=$rc_pid)."
return 1
else
echo "Starting ${name}."
cd /usr/local/ntpa/
${MONO} ntpa.exe --config ${config} --writepid ${pidfile} --temp ${tempdir} --daemon ${name} &
fi
}
ntpa_reload()
{
if [ ! -f ${pidfile} ]; then
_run_rc_notrunning
return 1
else
echo "Reloading ${name}."
rc_pid=`cat ${pidfile}`
kill -USR1 $rc_pid
fi
}
ntpa_stop()
{
if [ ! -f ${pidfile} ]; then
_run_rc_notrunning
return 1
else
echo "Stopping ${name}."
rc_pid=`cat ${pidfile}`
kill -TERM $rc_pid
wait_for_pids ${rc_pid}
fi
}
eval ": \${${name}_enable:=\"NO\"}"
eval ": \${${name}_config:=\"/usr/local/etc/ntpa/${name}.conf\"}"
eval ": \${${name}_tempdir:=\"/tmp/\"}"
config="$(eval echo \${${name}_config})"
tempdir="$(eval echo \${${name}_tempdir})"
pidfile="/var/run/${name}.pid"
run_rc_command "$1"
Executable
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
exec mono "/usr/local/ntpa/ntpac.exe" "$@"
Executable
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
exec mono "/usr/local/ntpa/ntpav.exe" "$@"