Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed May 07, 2014 5:15 pm 
Offline
Senior Newbie
User avatar

Joined: Sat Oct 30, 2010 12:53 pm
Posts: 19
Website: http://www.whyaskwhy.org/
Location: USA
Alright, I'm finally at a point where I feel I have this "good enough" so I can move on to other things. I'm sharing my findings here in case they can help someone else that may be affected by this in the future. Particularly as Les mentioned (paraphrasing) all of their hosts will likely have this problem eventually.

First, I nuked the contents of the /etc/network/if-up.d/ntpdate file as we don't need ntpdate to be called twice, particularly within a short period. When left in place I noticed that the clock was adjusted by X amount twice, which sent the clock into the past 2x what was needed. Once I removed the contents of that file I replaced with:

Code:
#!/bin/sh

# Comments here describing why the file was gutted

exit 0


Second, I dropped this Upstart job file into the /etc/init/ directory as /etc/init/ntpdate.conf. The minified version:

Code:
description "Sync clock prior to launching time-sensitive services"

task

start on (
    startup
    and static-network-up
)

script
    /usr/sbin/ntpdate -b -s ntp.ubuntu.com
end script



what I'm using:

Code:
# $Id$
# $HeadURL$

description "Sync clock prior to launching time-sensitive services"

################################################################################
# References:
#
#   http://upstart.ubuntu.com/cookbook/#run-a-job-before-another-job
#   http://upstart.ubuntu.com/cookbook/#start-depends-on-another-service
#   http://upstart.ubuntu.com/cookbook/#start-must-precede-another-service
#   http://upstart.ubuntu.com/cookbook/#really-understanding-start-on-and-stop-on
#   http://upstart.ubuntu.com/cookbook/#method-2
#   http://upstart.ubuntu.com/cookbook/#task
#   http://askubuntu.com/questions/21378/how-can-i-make-sure-one-upstart-job-starts-before-other-upstart-jobs/22110#22110
#   http://superuser.com/questions/502536/how-to-depend-on-an-upstart-job-from-an-init-script-on-ubuntu-12-04
#
# Set a VMware Player VM to NOT sync time between host/guest so I could set
# guest's clock to a false value so time syncing would be forced
#
#   http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1189
#
#   http://askubuntu.com/questions/62812/why-isnt-my-upstart-service-starting-on-system-boot
#   http://askubuntu.com/a/71426
################################################################################



# Execute this Upstart job at startup and once all network interfaces listed in
# /etc/network/interfaces have been brought online.

task

start on (
    startup
    and static-network-up
)


# Debug output to prove that this Upstart job is executing properly
pre-start script
  logger -p daemon.info -t "ntpdate.conf" "pre-start for ntpdate.conf"
end script

post-start script
  logger -p daemon.info -t "ntpdate.conf" "post-start for ntpdate.conf"
end script

script
    logger -p daemon.info -t "ntpdate.conf" "About to execute ntpdate"

    # Use hard-coded NTP server instead of parsing /etc/ntp.conf
    /usr/sbin/ntpdate -b -s ntp.ubuntu.com

    # Parse NTP config file to sync against multiple servers. Borrowed from
    # /etc/network/if-up.d/ntpdate
    #/usr/sbin/ntpdate-debian -s -b 2>/dev/null || :

    logger -p daemon.info -t "ntpdate.conf" "Just finished executing ntpdate"
end script



On my system this still leaves these four daemons starting with the wrong time, but unless they begin to show abnormal behavior I'm just going to leave things well enough alone (too much else to worry about):

* postgrey
* opendkim
* mysql
* slapd

I hope this helps someone.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group