50 # Build the command line flags |
50 # Build the command line flags |
51 # |
51 # |
52 shift $# |
52 shift $# |
53 set -- -p /var/run/ntp.pid |
53 set -- -p /var/run/ntp.pid |
54 # We allow a step larger than the panic value of 17 minutes only |
54 # We allow a step larger than the panic value of 17 minutes only |
55 # once when ntpd starts up. If always_all_large_step is true, |
55 # once when ntpd starts up. If always_allow_large_step is true, |
56 # then we allow this each time ntpd starts. Otherwise, we allow |
56 # then we allow this each time ntpd starts. Otherwise, we allow |
57 # it only the very first time ntpd starts after a boot. We |
57 # it only the very first time ntpd starts after a boot. We |
58 # check that by making ntpd write its pid to a file in /var/run. |
58 # check that by making ntpd write its pid to a file in /var/run. |
59 |
59 |
60 val=`svcprop -c -p config/always_allow_large_step $SMF_FMRI` |
60 val=`svcprop -c -p config/always_allow_large_step $SMF_FMRI` |
84 mdns=`svcprop -c -p general/enabled svc:/network/dns/multicast:default` |
84 mdns=`svcprop -c -p general/enabled svc:/network/dns/multicast:default` |
85 [ "$val" = "true" ] && [ "$mdns" = "true" ] && set -- "$@" -m |
85 [ "$val" = "true" ] && [ "$mdns" = "true" ] && set -- "$@" -m |
86 |
86 |
87 # We used to support the slewalways keyword, but that was a Sun thing |
87 # We used to support the slewalways keyword, but that was a Sun thing |
88 # and not in V4. Look for "slewalways yes" and set the new slew option. |
88 # and not in V4. Look for "slewalways yes" and set the new slew option. |
89 val=`svcprop -c -p config/slew_always $SMF_FMRI` |
89 slew_always=`svcprop -c -p config/slew_always $SMF_FMRI` |
90 if [ ! "$val" = "true" ]; then |
90 if [ ! "$slew_always" = "true" ]; then |
91 val=`/usr/bin/nawk '/^[ \t]*#/{next} |
91 slew_always=`/usr/bin/nawk '/^[ \t]*#/{next} |
92 /^[ \t]*slewalways[ \t]+yes/ { |
92 /^[ \t]*slewalways[ \t]+yes/ { |
93 printf("true", $2) |
93 printf("true", $2) |
94 next } ' /etc/inet/ntp.conf` |
94 next } ' /etc/inet/ntp.conf` |
95 fi |
95 fi |
96 [ "$val" = "true" ] && set -- "$@" --slew |
96 [ "$slew_always" = "true" ] && set -- "$@" --slew |
97 |
97 |
98 # Set up debugging. |
98 # Set up debugging. |
99 deb=`svcprop -c -p config/debuglevel $SMF_FMRI` |
99 deb=`svcprop -c -p config/debuglevel $SMF_FMRI` |
|
100 |
|
101 # If slew_always is set to true, then the large offset after a reboot |
|
102 # might take a very long time to correct the clock. Optionally allow |
|
103 # a step once after a reboot if slew_always is set when allow_step_at_boot |
|
104 # is also set. Unfortunately ntpd in ntpdate mode is a little too |
|
105 # chatty, so direct the log to /dev/null. And since the offset might be |
|
106 # more than 17 minutes, allow larger steps with the "-g". |
|
107 # |
|
108 val=`svcprop -c -p config/allow_step_at_boot $SMF_FMRI` |
|
109 if [ "$val" = "true" ] && [ "$slew_always" = "true" ] && \ |
|
110 [ ! -f /var/run/ntp.pid ]; then |
|
111 /usr/lib/inet/ntpd -q -l /dev/null -g |
|
112 fi |
100 |
113 |
101 # Start the daemon. If debugging is requested, put it in the background, |
114 # Start the daemon. If debugging is requested, put it in the background, |
102 # since it won't do it on it's own. |
115 # since it won't do it on it's own. |
103 if [ "$deb" -gt 0 ]; then |
116 if [ "$deb" -gt 0 ]; then |
104 /usr/lib/inet/ntpd "$@" --set-debug-level=$deb >/var/ntp/ntp.debug & |
117 /usr/lib/inet/ntpd "$@" --set-debug-level=$deb >/var/ntp/ntp.debug & |