Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting date and Time on Redhat 2

Status
Not open for further replies.

zum

Technical User
Mar 31, 2003
148
US
I need to set my date and time on Redhat. We don't have GUI running so I can't set it that way. Can some one give me an example of the format to use. I you could provide an example with setting today's date that would be great.

Thanks.
 
What I do is set up a cron job that runs every morning at 2AM:
Code:
/usr/bin/rdate -s server && /sbin/hwclock -w

where server is the name of an NTP server (preferably second- or third-tier). This of course assumes you have rdate installed.
 
Here is a quick one

Code:
date -s yyyy/mm/dd hh:mm:ss

Cheers

QatQat

Life is what happens when you are making other plans.
 
Seem to recall that if you want to set the date (rather than just query it) you need to be root.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Thanks for a the responses. I got it set.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top