Operating System - HP-UX
1833788 Members
2507 Online
110063 Solutions
New Discussion

Re: Changing & Synchronizing system date

 
John Jayaseelan
Super Advisor

Changing & Synchronizing system date

Hi,

-Is it possible to just change the (HP-UX 11.0) system date without changing the other attributes (month, year, hour, mintues etc), If so how?

- How to synchronize system date and time of HP_UX server against other HP_UX server.

Thanks
John Jayaseelan
16 REPLIES 16
James R. Ferguson
Acclaimed Contributor

Re: Changing & Synchronizing system date

Hi John:

You need to configurate Network Time Protocol (NTP) to synchronize your server's clock to an external time source.

Chapter-7 of "Installing and Administering Internet Services" provides a good discussion of 'ntpd' implementation for HP-UX.

http://docs.hp.com/hpux/onlinedocs/B2355-90685/B2355-90685.html

For a list of external sources from which to derive correct time, and for other, general information see here:

http://www.ntp.org/index.html

Your internal clock runs UTC (Universal Time) but the value of your TIMEZONE (TZ) determines the *external*, user-perceived date and time (EST, MST, etc.).

Regards!

...JRF...
Zeev Schultz
Honored Contributor

Re: Changing & Synchronizing system date

1)using /usr/bin/date,read man date 4 more.
2)using ntp protocol.man xntpd,man ntpdate.

Zeev
So computers don't think yet. At least not chess computers. - Seymour Cray
John Jayaseelan
Super Advisor

Re: Changing & Synchronizing system date

Hi,

Some posting in the forums say changing the system date might affect OS installation. If so, What are all the issues in changing the system date and how that can be rectified.

Thanks
John Jayaseelan
Zeev Schultz
Honored Contributor

Re: Changing & Synchronizing system date

Please clarify,installing an OS after system time change can affect... If you perform clean
install you're choosing the time zone,am I correct?Or you mean update-install...
Post such a link where the things are.

Zeev
So computers don't think yet. At least not chess computers. - Seymour Cray
Darren Prior
Honored Contributor

Re: Changing & Synchronizing system date

Hi John,

In which direction are you intending to change the date, and by how many days?

regards,

Darren.
Calm down. It's only ones and zeros...
John Jayaseelan
Super Advisor

Re: Changing & Synchronizing system date

Hi,

Just increase the date by 5 days without altering the time,year,minutes etc. Is it possible to just change the date in the system date without altering other attributes. If so how the date command needs to be used. help pages does not reveal much.

After testing synchronize the date time with Other HP-UX server.

Thanks
Stuart Abramson_2
Honored Contributor

Re: Changing & Synchronizing system date

1. You can change the date. If you change forward, not much happens. If you change backward, UNIX doesn't mind much, but Oracle will duplicate timestamps on records and have a fit.

2. You synchronize time with NTP, Network Time Protocl, xntpd. Email if you want setup details.

Stuart
Chris Vail
Honored Contributor

Re: Changing & Synchronizing system date

Let me advise you to seriously check out Time Machine, from www.solution-soft.com/timemachine.shtml

This replaces the clock driver normally resident in the kernel with its own application software. That means that you can have your operating system at perfectly synchronized time, but your applications (oracle, anything/anybody else)have their own exclusive date and time. You can give them permission to set their own date stamp. They can "freeze" time so that their clock doesn't advance. You could have 200 users, each with a different time stamp.

Its a nice piece of software, and not horribly expensive ($8k USD). They give a free 30 day trial, so you should look into this.



Chris
twang
Honored Contributor

Re: Changing & Synchronizing system date

1. Set the date to Jun 18, 10:35 p.m.
# date 06182235
2. Setup NTP,
2.1.server
# vi /etc/ntp.conf
server 127.127.1.1
fudge 127.127.1.1 stratum 10
# vi /etc/rc.config.d/netdaemons
NTPDATE_SERVER=
XNTPD=1
XNTPD_ARGS
# /sbin/init.d/xntpd start
2.2.client
# vi /etc/ntp.conf
server 128.1.1.1
driftfile /etc/ntp.drift
# vi /etc/rc.config.d/netdaemons
NTPDATE_SERVER=128.1.1.1
XNTPD=1
XNTPD_ARGS=
# /sbin/init.d/xntpd start
2.3 to make the change
# ntpdate tick.usnogps.navy.mil

twang
Honored Contributor

Re: Changing & Synchronizing system date

1. Set the date to Jun 18, 10:35 p.m.
# date 06182235
2. Setup NTP,
2.1.server
# vi /etc/ntp.conf
server 127.127.1.1
fudge 127.127.1.1 stratum 10
# vi /etc/rc.config.d/netdaemons
NTPDATE_SERVER=
XNTPD=1
XNTPD_ARGS
# /sbin/init.d/xntpd start
2.2.client
# vi /etc/ntp.conf
server 128.1.1.1
driftfile /etc/ntp.drift
# vi /etc/rc.config.d/netdaemons
NTPDATE_SERVER=128.1.1.1
XNTPD=1
XNTPD_ARGS=
# /sbin/init.d/xntpd start
2.3 to make the change
# ntpdate server.com

Bill Douglass
Esteemed Contributor

Re: Changing & Synchronizing system date

John, the system date is stored in terms of secords from the epoch (Jan 1, 1970). The clock has no concepts of days, week, months etc. So no, you can't chnage just the day of month, because there is no such beast in the system.

You can achieve the same thing by carefuly formatting the date string when using the date command

date MMDDhhmm

MM = Month
DD = day of month
hh = hour
mm = minutes

These are the minimum values you must specify with the date command.

If you set up ntp on your host, then you can use the ntpdate command to sync your clock initially, and run the xntpd daemon to keep it in sync. Keep in mind that if you set the system clock to a specific value, ntp will override this with whatever time its sources claim is accurate.
John Jayaseelan
Super Advisor

Re: Changing & Synchronizing system date

Hi,

Is the following syntax correct to just change the system date to 25 leaving attributes as it is.

date `date "+%m25%H%M%S"`
When tried, received the following message
date: exceeds maximum date.

When tried without %S date `date "+%m25%H%M"` got the message 'date: do you really want to run time backwards?[yes/no]'.

Could you please confirm changing the time does not affect the OS.

Thanks
Bill Douglass
Esteemed Contributor

Re: Changing & Synchronizing system date

The format specifiers (the %M, %S and so on) are only used for printing out the current date/time in a specific way. They are not used when changing the date.

To do so, you must use the syntax

date MMDDhhmm[ccyy]

e.g.

date 061810382003

You must specify at ;east the month, day, hour and minutes. Century and year are optional.

If you change the date, you may affect certain programs on your system. Examples of this(as mentioned) are Oracle, crond, make, SCCS, and any currently running programs that make time-based calculations. See the warnings section of the date man page for more specifics.
Caesar_3
Esteemed Contributor

Re: Changing & Synchronizing system date

Hello!

For sync the time you can use the ntp
or you can use the rdate that i added
to this msg.
Check it it's compiled for hpux
usage: rdate

Caesar
John Jayaseelan
Super Advisor

Re: Changing & Synchronizing system date

Hi,

rdate is not available in HP-UX 11 server.

Thanks
Caesar_3
Esteemed Contributor

Re: Changing & Synchronizing system date

Hello!

Yes it's not part of hpux so if you check
you will see that i added compiled version
for hpux to my prev. msg
Save it, unzip and use.

Caesar