หน้าเว็บ

Thursday, March 21, 2013

Date and Time

Show Date and Time

[root@myserver ~]# date
Thu Mar 21 14:31:59 ICT 2013

Date Configuration

Change the current date.

[root@myserver ~]# date +%D -s YYYY-MM-DD

YYYY a four-digit year
MM a two-digit month
DD a two-digit day of the month


Change the current time.

[root@myserver ~]# date +%T -s HH:MM:SS

HH hour (00..23)
MM minute (00..59)
SS second (00..59)


Change date and time from remote server

  1. Verify that NTP Server has ntpd service is running
    [root@ntpserver ~]#  service ntpd status
    ntpd is stopped
    [root@ntpserver ~]#  service ntpd start
    Starting ntpd:                                             [  OK  ]
    [root@ntpserver ~]#  service ntpd status
    ntpd (pid  28436) is running...
      
  2. Firstly, check whether the selected NTP server is accessible
    [root@myserver ~]# ntpdate -q ntpserver_address/hostname
      
  3. When you find a satisfactory server, run the ntpdate command followed by one or more server addresses
    [root@myserver ~]# ntpdate ntpserver_address/hostname [ ... ]
      
  4. In most cases, these steps are sufficient. Only if you really need one or more system services to always use the correct time, enable running the ntpdate at boot time
    [root@myserver ~]# chkconfig ntpdate on
      

Refer to:redhat.com: Date and Time Configuration

No comments:

Post a Comment