diff options
author | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2020-12-07 19:56:47 +0100 |
---|---|---|
committer | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2020-12-07 19:56:47 +0100 |
commit | 912fc819e5087f071b591ac0433c0aa82ebd12da (patch) | |
tree | ed592ad44b4ef40fd06c13746f2d71a7292d6efc | |
parent | ba29d87838b8716c8364ea91956318a644630021 (diff) | |
download | ntpd-setwait-912fc819e5087f071b591ac0433c0aa82ebd12da.tar.gz ntpd-setwait-912fc819e5087f071b591ac0433c0aa82ebd12da.tar.bz2 ntpd-setwait-912fc819e5087f071b591ac0433c0aa82ebd12da.zip |
init.d: update init scripts with new -i argument
Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
-rwxr-xr-x | init.d/ntpd-setwait | 7 | ||||
-rw-r--r-- | init.d/ntpd-setwait.conf | 8 | ||||
-rwxr-xr-x | init.d/ntpd-setwait.openrc | 7 |
3 files changed, 20 insertions, 2 deletions
diff --git a/init.d/ntpd-setwait b/init.d/ntpd-setwait index b1fff45..cf7cdea 100755 --- a/init.d/ntpd-setwait +++ b/init.d/ntpd-setwait @@ -41,6 +41,11 @@ NTPD_OPTS=${NTPD_OPTS:=""} PID_FILE=${PID_FILE:="/var/run/ntpd.pid"} PROGRAM_LOG=${PROGRAM_LOG:="/var/log/ntpd-setwait.log"} +host= +if [ "${NTP_HOST}" ]; then + host="-i${NTP_HOST}" +fi + command=/usr/local/bin/ntpd-setwait @@ -64,7 +69,7 @@ start() { /sbin/start-stop-daemon --make-pidfile --pidfile "${PID_FILE}" \ --start --background --name ntpd-setwait --stderr ${PROGRAM_LOG} \ - --exec ${command} -- -f ${MAX_DEVIATION} ${NTPD_BIN} ${NTPD_OPTS} + --exec ${command} -- -f ${host} ${MAX_DEVIATION} ${NTPD_BIN} ${NTPD_OPTS} if [ "$?" -ne "0" ] ; then echo "error" diff --git a/init.d/ntpd-setwait.conf b/init.d/ntpd-setwait.conf index 3823814..87e792d 100644 --- a/init.d/ntpd-setwait.conf +++ b/init.d/ntpd-setwait.conf @@ -6,6 +6,14 @@ MAX_DEVIATION=300 ### +# by default, ntpd-setwait consults pool.ntp.org to find suitable ntp +# host, this will require internet connection. You can specify own +# IP address (like from local network) to be able to set time on local +# network without internet + +#NTP_HOST=10.1.1.1 + +### # ntpd binary to use, should be full absolute path # diff --git a/init.d/ntpd-setwait.openrc b/init.d/ntpd-setwait.openrc index ee954b6..412b6d3 100755 --- a/init.d/ntpd-setwait.openrc +++ b/init.d/ntpd-setwait.openrc @@ -6,6 +6,11 @@ NTPD_OPTS=${NTPD_OPTS:=""} PID_FILE=${PID_FILE:="/var/run/ntpd.pid"} PROGRAM_LOG=${PROGRAM_LOG:="/var/log/ntpd-setwait.log"} +host= +if [ "${NTP_HOST}" ]; then + host="-i${NTP_HOST}" +fi + command=/usr/bin/ntpd-setwait depend() { @@ -18,7 +23,7 @@ start() { /sbin/start-stop-daemon --make-pidfile --pidfile "${PID_FILE}" \ --start --background --name ntpd-setwait --stderr ${PROGRAM_LOG} \ - --exec ${command} -- -f ${MAX_DEVIATION} ${NTPD_BIN} ${NTPD_OPTS} + --exec ${command} -- -f ${host} ${MAX_DEVIATION} ${NTPD_BIN} ${NTPD_OPTS} eend $? } |