HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- NTP With Offset
Operating System - HP-UX
1836993
Members
2355
Online
110111
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2002 05:32 PM
07-22-2002 05:32 PM
NTP With Offset
Hi
Does anyone know if there is a way to synch server time using NTP and at the same time introduce an offset in the timing?
So I can be sure one of the server is always exactly 5 minutes behind the other servers when all are sync using NTP
Does anyone know if there is a way to synch server time using NTP and at the same time introduce an offset in the timing?
So I can be sure one of the server is always exactly 5 minutes behind the other servers when all are sync using NTP
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2002 05:59 PM
07-22-2002 05:59 PM
Re: NTP With Offset
Wow! This is a strange request. I can think of a few schemes that might work. e.g. calling ntpq to query the time servers and then making a call to the adjtime() system call.
Do you really want the system time off by 5 minutes? That is really considered a big no-no especially in NFS or rdist environments. A better answer might be to create a custom TZ variable to control how time is DISPLAYED. That would be much more sensible and safe.
Perhaps if you explained what you are trying to do, someone could offer a better solution. I have a hard time believing that lying to a system about the time is ever a good idea.
Do you really want the system time off by 5 minutes? That is really considered a big no-no especially in NFS or rdist environments. A better answer might be to create a custom TZ variable to control how time is DISPLAYED. That would be much more sensible and safe.
Perhaps if you explained what you are trying to do, someone could offer a better solution. I have a hard time believing that lying to a system about the time is ever a good idea.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2002 06:51 AM
07-23-2002 06:51 AM
Re: NTP With Offset
Hi
Yeah I know it is kinda of a weird request.
I need to do it this way cause i got 2 different application running on the 2 machines.
If the application on machine A sends a message with a timestamp that is that is about the same as the time on machine B, the application puts the message in a pending queue and wont come back to it till an hour later.
If the timestamp is later than the time on machine B, it is processed immediately. It's a screw up logic but thats why I need to make sure that one of the machine is always 5 minutes behind the other and still synch with the NTP server. I need the NTP synch because I cant let the time gap get too big and the 2 machines need to be in synch with another couple of servers
Yeah I know it is kinda of a weird request.
I need to do it this way cause i got 2 different application running on the 2 machines.
If the application on machine A sends a message with a timestamp that is that is about the same as the time on machine B, the application puts the message in a pending queue and wont come back to it till an hour later.
If the timestamp is later than the time on machine B, it is processed immediately. It's a screw up logic but thats why I need to make sure that one of the machine is always 5 minutes behind the other and still synch with the NTP server. I need the NTP synch because I cant let the time gap get too big and the 2 machines need to be in synch with another couple of servers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2002 07:59 AM
07-23-2002 07:59 AM
Re: NTP With Offset
Okay, here is a screwball method that should work reasonably well. First, you need to disable the NTP client services on the box that is to run 5 minutes behind. Next, you should cron a job to execute this every 12 hours or so on the box that runs 5 minutes behind. (I haven't bothered to do all the PATH exports that a cron would require).
#!/usr/bin/sh
STAT=0
REMOTETIMESOURCE="remhost"
OFFSET=300 # seconds
REMOTE_SECONDS=$(remsh ${REMOTETIMESOURCE} perl -e \'print time\;\')
LOCAL_SECONDS=$(perl -e 'print time;')
ADJ=$((${REMOTE_SECONDS} - ${LOCAL_SECONDS} - ${OFFSET}))
if [[ ${ADJ} -lt 1 || ${ADJ} -gt 1 ]]
then
date -a ${ADJ}
STAT=${?}
fi
exit ${STAT}
This obviously can't keep you exactly 5 minutes apart but it should be able to keep you within 1 or 2 seconds of 5 minutes.
It does use the date -a command to slew the time rather than step adjust the time. You certainly don't want to step adjust your system time. Don't be tempted to run this every 5 minutes or so because you want to allow enough time for the last date -a slew adjustment to finish. Man date for details.
#!/usr/bin/sh
STAT=0
REMOTETIMESOURCE="remhost"
OFFSET=300 # seconds
REMOTE_SECONDS=$(remsh ${REMOTETIMESOURCE} perl -e \'print time\;\')
LOCAL_SECONDS=$(perl -e 'print time;')
ADJ=$((${REMOTE_SECONDS} - ${LOCAL_SECONDS} - ${OFFSET}))
if [[ ${ADJ} -lt 1 || ${ADJ} -gt 1 ]]
then
date -a ${ADJ}
STAT=${?}
fi
exit ${STAT}
This obviously can't keep you exactly 5 minutes apart but it should be able to keep you within 1 or 2 seconds of 5 minutes.
It does use the date -a command to slew the time rather than step adjust the time. You certainly don't want to step adjust your system time. Don't be tempted to run this every 5 minutes or so because you want to allow enough time for the last date -a slew adjustment to finish. Man date for details.
If it ain't broke, I can fix that.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP