|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Red Hat Red Hat is the world's leading open source technology solutions provider with offerings including Red Hat Enterprise Linux (RHEL), Fedora, open source applications, security and systems management, virtualization, and Services Oriented Architecture (SOA) solutions. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Right way to change time for a RHEL server
I had the query of what would be the right approach to change the time on the RHEL server. I have the following ways to do that: 1) Code:
# date -s "2 OCT 2006 18:00:00" Or Code:
# date --set="2 OCT 2006 18:00:00" 2) Code:
# date +%Y%m%d -s "20081128" The second option though would only change the date but not the time. I hope, my query is clear about what is the right way to change time for a RHEL server. Please revert with the reply to my query. Regards Last edited by Scott; 01-07-2013 at 04:24 AM.. Reason: Code tags, please... |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
The simplest way to set the date is as described in the manual page. Code:
date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] So that would be: Code:
date 100218002006 |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
thanks for your answer but can we include the seconds also.
|
|
#4
|
|||
|
|||
|
If this is a production server: Code:
1. you should be using ntp services, not manually changing dates 2. When you manually change date/time over any substantial time value you run the risk of breaking things like cron jobs, or application software with services that are time dependent. answer to your question after you have the date completely correct, you can set time: Code:
date '+%T' -s "11:14:00" note that it uses your example 2 of setting time. and configure and start ntp. |
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
Well as pointed out, it's recommended to use the NTP servers for updating date/time using the
ntpdate command.
If this is not available, then the next recommended method is to use the hwclock --hctosys command. This sets the system time as BIOS time. date command should always be avoided as setting date and time with this command introduces errors in time which could mess things up like kerberos. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Time Sync issue on RHEL 5.3 | uday123 | Red Hat | 2 | 10-12-2009 09:58 AM |
| Date time issues on RHEL | sumitb74 | UNIX for Dummies Questions & Answers | 5 | 07-21-2008 06:46 AM |
| RHEL 4 U5 - Server immediate shutdown | mr_bold | UNIX for Advanced & Expert Users | 2 | 08-04-2007 04:33 AM |
| RHEL 3 - how to change the SNMP community strings? | BG_JrAdmin | Red Hat | 0 | 06-19-2006 04:22 PM |
| To simultaneously update password change in two server at a time | s_chandrakar | Shell Programming and Scripting | 0 | 11-07-2005 09:25 AM |
|
|