[pkg-ntp-maintainers] Bug#388328: boot logging fix for ntpdate in /etc/init.d

Rick Thomas rbthomas55 at pobox.com
Tue Sep 19 22:10:15 UTC 2006


Package: ntpdate

I was Poking around in /var/log/syslog recently.  I noticed that  
there was no log entry for ntpdate.  Investigating a little, I found  
that /etc/init.d/ntpdate (alias /etc/rcS.d/S51ntpdate) is called  
before syslogd gets started.

This is OK... The ntpdate call has to occur pretty early in the boot  
process to avoid problems with time stepping backwards (or forwards  
by large amounts) during the rest of the initialization processes.

The net result is that you would only see the ntpdate log entry if  
you turned on bootlogd.  So I turned on bootlogd, just to make sure  
ntpdate was getting called properly.  Lo and behold!  Following a  
reboot, there was no ntpdate entry visible in /var/log/boot.

The problem is that ntpdate is getting called with a "-s" option, but  
syslogd isn't there to catch the log entries.

The attached patch fixes that.

I used "log_action_msg" instead of "log_action_begin_msg" because the  
output of ntpdate is intended to stand alone on a line by itself, not  
as part of a stream of text.

Enjoy!

Rick

========== cut here =============
rick at darkstar:~$ diff -c /etc/init.d/ntpdate /tmp/ntpdate
*** /etc/init.d/ntpdate Wed Aug  9 08:52:47 2006
--- /tmp/ntpdate        Tue Sep 19 17:06:08 2006
***************
*** 25,32 ****

   case $1 in
         start|force-reload)
!               log_action_begin_msg "Running ntpdate to synchronize  
clock"
!               $PROG -b -s $NTPOPTIONS $NTPSERVERS
                 log_action_end_msg $?
                 ;;
         restart|try-restart|reload)
--- 25,34 ----

   case $1 in
         start|force-reload)
!               # no -s option so output will go to console (and  
bootlog if enabled) when starting up
!               # this happens before syslogd is started, so no point  
in sending it to (nonexistent) syslog
!               log_action_msg "Running ntpdate to synchronize clock"
!               $PROG -b $NTPOPTIONS $NTPSERVERS
                 log_action_end_msg $?
                 ;;
         restart|try-restart|reload)
========== cut here =============






More information about the pkg-ntp-maintainers mailing list