0

In cron.log I can see that ntpdate is being triggered from a cron job which is running daily at 23:15

Mar 10 23:15:01 seitan /USR/SBIN/CRON[22407]: (root) CMD (/etc/network/if-up.d/ntpdate)

But I cannot seem to find the cron job that is causing these messages to fill up my syslog

Mar 10 23:15:01 seitan ntpdate[22416]: the NTP socket is in use, exiting

I'm guessing I need to change this cron job to stop the ntp service before this command executes, then start it again afterwards, but I don't know where this is being triggered from. I have checked the cron.daily directory and it only contains a file ntp which only seems to rotate the ntp stats (contents below):

#!/bin/sh

# The default Debian ntp.conf enables logging of various statistics to
# the /var/log/ntpstats directory.  The daemon automatically changes
# to a new datestamped set of files at midnight, so all we need to do
# is delete old ones, and compress the ones we're keeping so disk
# usage is controlled.

statsdir=$(cat /etc/ntp.conf | grep -v '^#' | sed -n 's/statsdir \([^ ][^ ]*\)/\1/p')

if [ -n "$statsdir" ] && [ -d "$statsdir" ]; then
    # only keep a week's depth of these
    find "$statsdir" -type f -mtime +7 -exec rm {} \;

    # compress whatever is left to save space
    cd "$statsdir"
    ls *stats.???????? > /dev/null 2>&1
    if [ $? -eq 0 ]; then
            # Note that gzip won't compress the file names that
            # are hard links to the live/current files, so this
            # compresses yesterday and previous, leaving the live
            # log alone.  We supress the warnings gzip issues
            # about not compressing the linked file.
            gzip --best --quiet *stats.????????
            return=$?
            case $return in
                2)
                    exit 0                  # squash all warnings
                    ;;
                *)
                    exit $return            # but let real errors through
                    ;;
            esac
    fi
fi

I have never touched any of the ntp configuration in the system.

4
  • change this cron job to stop the ntp service before this command executes - No, don't do this. The NTP server needs to stay running for the most precise time. If you have a correctly configured ntp daemon, then do not use ntpdate.
    – Zoredache
    Mar 12, 2015 at 17:33
  • I never changed any of these settings so I don't know where it's being triggered from in order to deactivate the ntpdate cron job Mar 12, 2015 at 17:38
  • 1
    Tell us more about your system then? What distro? How did it get installed (is it a hosted VM)? With more details about your system, someone might know where the default jobs are configured. Past that I would just do a cd /etc ; grep ntpdate * -R and cd /var/spool/cron ; grep ntpdate * -R. Figure out the purpose of each matching file.
    – Zoredache
    Mar 12, 2015 at 17:52
  • @Zoredache thank you - /var/spool/cron/crontabs/root had the line containing the ntpdate cron job! If you'd like to enter that as an answer I will mark it correct Mar 12, 2015 at 18:22

1 Answer 1

2

If you have ntp running and configured correctly, there should be no need to run ntpdate at all.

All I typically use it for is to manually set the clock during installation.

2
  • Thanks, see my edit - I have never touched any of the ntp configuration in the system. Mar 12, 2015 at 17:33
  • Remove or disable ntpdate it may be leftover from an old version. ntp now does everything that used to require ntpdate.
    – BillThor
    Mar 13, 2015 at 0:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .