diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:20:04 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:20:04 +0200 |
commit | 1b8dfe266937a37a4c642f96ceb2347bf4c00a17 (patch) | |
tree | 0c6aab146bb3c82efd9c7846a9a4e70dcb0ec84f /meta-networking/recipes-support/ntp/files/ntpd | |
download | meta-openembedded-daisy-140929.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-networking/recipes-support/ntp/files/ntpd')
-rwxr-xr-x | meta-networking/recipes-support/ntp/files/ntpd | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/ntp/files/ntpd b/meta-networking/recipes-support/ntp/files/ntpd new file mode 100755 index 0000000000..a62b8ce691 --- /dev/null +++ b/meta-networking/recipes-support/ntp/files/ntpd | |||
@@ -0,0 +1,64 @@ | |||
1 | #! /bin/sh | ||
2 | # | ||
3 | PATH=/sbin:/bin:/usr/bin:/usr/sbin | ||
4 | |||
5 | # ntpd init.d script for ntpdc from ntp.isc.org | ||
6 | test -x /usr/sbin/ntpd -a -r /etc/ntp.conf || exit 0 | ||
7 | # rcS contains TICKADJ | ||
8 | test -r /etc/default/rcS && . /etc/default/rcS | ||
9 | |||
10 | # Functions to do individual actions | ||
11 | settick(){ | ||
12 | # If TICKADJ is set we *must* adjust it before we start, because the | ||
13 | # driftfile relies on the correct setting | ||
14 | test -n "$TICKADJ" -a -x /usr/sbin/tickadj && { | ||
15 | echo -n "Setting tick to $TICKADJ: " | ||
16 | /usr/sbin/tickadj "$TICKADJ" | ||
17 | echo "done" | ||
18 | } | ||
19 | } | ||
20 | startdaemon(){ | ||
21 | # The -g option allows ntpd to step the time to correct it just | ||
22 | # once. The daemon will exit if the clock drifts too much after | ||
23 | # this. If ntpd seems to disappear after a while assume TICKADJ | ||
24 | # above is set to a totally incorrect value. | ||
25 | echo -n "Starting ntpd: " | ||
26 | start-stop-daemon --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@" | ||
27 | echo "done" | ||
28 | } | ||
29 | stopdaemon(){ | ||
30 | echo -n "Stopping ntpd: " | ||
31 | start-stop-daemon --stop -p /var/run/ntp.pid | ||
32 | echo "done" | ||
33 | } | ||
34 | |||
35 | case "$1" in | ||
36 | start) | ||
37 | settick | ||
38 | startdaemon -g | ||
39 | ;; | ||
40 | stop) | ||
41 | stopdaemon | ||
42 | ;; | ||
43 | force-reload) | ||
44 | stopdaemon | ||
45 | settick | ||
46 | startdaemon -g | ||
47 | ;; | ||
48 | restart) | ||
49 | # Don't reset the tick here | ||
50 | stopdaemon | ||
51 | startdaemon -g | ||
52 | ;; | ||
53 | reload) | ||
54 | # Must do this by hand, but don't do -g | ||
55 | stopdaemon | ||
56 | startdaemon | ||
57 | ;; | ||
58 | *) | ||
59 | echo "Usage: ntpd { start | stop | restart | reload }" >&2 | ||
60 | exit 1 | ||
61 | ;; | ||
62 | esac | ||
63 | |||
64 | exit 0 | ||