diff options
author | Jeremy Lainé <jeremy.laine@m4x.org> | 2009-11-03 17:20:53 +0100 |
---|---|---|
committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2009-11-03 17:20:53 +0100 |
commit | d62c9c524449adadd7af3bc76f1230e227b5b0c6 (patch) | |
tree | 8fd907e21dfad9b1483416f362d772401c55bbae /recipes/ntp/ntp-4.2.4p7/ntpdate | |
parent | af05f65b38bc442c370637210e78975517e71f44 (diff) |
ntp-4.2.4p7: invoke ntpdate using if-up.d, not an init script
* provide an if-up.d script for ntpdate (based on Debian's)
* remove invocation of update-rc.d busybox-cron, this should
definitely not be part of the ntpdate package
Diffstat (limited to 'recipes/ntp/ntp-4.2.4p7/ntpdate')
-rwxr-xr-x | recipes/ntp/ntp-4.2.4p7/ntpdate | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/recipes/ntp/ntp-4.2.4p7/ntpdate b/recipes/ntp/ntp-4.2.4p7/ntpdate new file mode 100755 index 0000000000..5b139ed1ed --- /dev/null +++ b/recipes/ntp/ntp-4.2.4p7/ntpdate @@ -0,0 +1,45 @@ +#!/bin/sh + +PATH=/sbin:/bin:/usr/bin + +test -x /usr/bin/ntpdate || exit 0 + +if test -f /etc/default/ntpdate ; then +. /etc/default/ntpdate +else +NTPSERVERS="pool.ntp.org" +fi + +test -n "$NTPSERVERS" || exit 0 + +# This is a heuristic: The idea is that if a static interface is brought +# up, that is a major event, and we can put in some extra effort to fix +# the system time. Feel free to change this, especially if you regularly +# bring up new network interfaces. +if [ "$METHOD" = static ]; then + OPTS="-b" +fi + +if [ "$METHOD" = loopback ]; then + exit 0 +fi + +( + +LOCKFILE=/var/lock/ntpdate + +# Avoid running more than one at a time +if [ -x /usr/bin/lockfile-create ]; then + lockfile-create $LOCKFILE + lockfile-touch $LOCKFILE & + LOCKTOUCHPID="$!" +fi + +/usr/bin/ntpdate -s $OPTS $NTPSERVERS 2>/dev/null || : + +if [ -x /usr/bin/lockfile-create ] ; then + kill $LOCKTOUCHPID + lockfile-remove $LOCKFILE +fi + +) & |