There are several ways of update date and time in linux , among which the simplest are:
For server
Easier however, there is the need to have internet connection, and ntpdate installed.
If you do not have ntpdate installed you can install from source: http://www.ntp.org/downloads.html , or whether you have the aptitude:
aptitude install ntpdate
You can find a list of servers ntp's the link: http://support.ntp.org/bin/view/Servers/NTPPoolServers
ntpdate pool.ntp.org
Logical disjunction
ntpdate-u ntp.usp.br
also can use the ip national observatory :
ntpdate-u 200.20.186.75
We can also put the script in cron to be checked hourly.
crontab-e
and put the code:
00 **** ntpdate-u pool.ntp.org
For the date command
This update can separate the date and time
Updating data
date-s 'yyyymmdd'
yyyy : the 4-digit year
mm : the 2-digit month
dd : the 2-digit day
Updating time
date-s 'hh: mm: ss'
hh : time from 00 to 23
mm : the 2-digit minute 00-59
ss : seconds with 2 digits 00-59
Leave a Comment