enable/disable ntp service on ubuntu 12.04

14,617

Solution 1

Coming in a couple years late, but hopefully it will help.

This will fix the unexpected interaction between ntpdate & ntp:

rm -f /etc/network/if-up.d/ntpdate

Then when you do a "update-rc.d ntp disable", ntp won't start on reboot.

Solution 2

The ntpdate command is a program that can be used to set the system time one off. There is nothing to enable or disable with ntpdate and nor does it control the ntp service.

The ntp service controls the action of the ntpd daemon. This can be disabled with the command

update-rc.d ntp disable

and then you can start and stop it using the service command

service ntp start
service ntp stop

On an Ubuntu system I have to hand with both ntp and ntpdate installed, this all works as expected. Disabling the ntp service and rebooting, the service remains off.

Share:
14,617

Related videos on Youtube

ntphelp
Author by

ntphelp

Updated on September 18, 2022

Comments

  • ntphelp
    ntphelp over 1 year

    Our application runs on Ubuntu 12.04 Precise. On this server, we have both ntpdate and ntp.

    How to enable and disable the NTP service on-demand? I tried

    # sudo update-rc.d -f ntp remove/default
    

    and

    # sudo update-rc.d ntp enable/disable 
    

    commands, but when I reboot server the ntp service starts running!

    I suspect ntpdate is starting ntp service on reboot. I removed ntpdate package from one of my experimental server, then ntp didn't start on reboot after issuing:

    # update-rc.d ntp disable
    

    Is there a way to control this? or is there way to permanently disable ntpdate?

    • ntphelp
      ntphelp almost 11 years
      I see ntpdate is starting ntp service on interface up. once I put exit 0 on top of the script /etc/network/if-up.d/ntpdate everything is working as intended.
    • mirkobrankovic
      mirkobrankovic almost 10 years
      I have the exact sae behaviour. Did you manage to ofind othe solution. I needed to remove the ntp to get it not boot up :D
  • ntphelp
    ntphelp almost 11 years
    I followed the same steps but not working for me! I also tried by freshly installing ntpdate and ntp but same result- ntp is stating on reboot. Is there a way to find in logs who is staring ntp? I see all the ntp rc files are in kill mode after issuing update-rc.d ntp disable command!
  • ntphelp
    ntphelp almost 11 years
    Thanks japao. I tried this also but no use. I even set usentpconf option to NO. Nothing is helping me.