Page tree
Skip to end of metadata
Go to start of metadata

Nowadays you can just use ntp daemon. However, I used to use the traditional means to syncing time. This approach was taught to me by Dickson and works on systems other than Ubuntu.

The advantage over the traditional cron tab approach is,

  • Less inconsistency in logs for when there are large time corrections. 
  • A little processing power and memory, but for a modern server this is negligible.

date # determine current timezone

If need be change your time zone,

sudo dpkg-reconfigure tzdata # sets the timezone

Next we make sure the time stays correct.

Make ntpdate Scheduled in the chrontab (Scheduled Job):

sudo crontab -e

At this point you will be asked to choose a default editor. I recommend selecting nano if you are a beginner. You can always change the default editor later with, select-editor.

Add to the bottom of the file,

# update time and date every morning at 5:00.
00 05 * * * ntpdate

Hit keys, CTRL-O and Enter (save in nano)
Hit keys, CTRL-X (exit in nano)

Here is another method using a file creation.

Next, verify that the crontab was updated successfully by listing the crontab. (Note: you don't need sudo to do this).

crontab -l
  • No labels