LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-11-2012, 08:32 PM   #1
boomboom
LQ Newbie
 
Registered: Jul 2011
Posts: 10

Rep: Reputation: Disabled
time sync. (other than NTP)


I have several machines, but they always have time difference greater than a hour. But I cannot use NTP, any method (e.g. run a series of commands), such that all machines can sync. time to a machine (server). I allow the time difference is a few seconds.
 
Old 01-12-2012, 01:44 AM   #2
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 202

Rep: Reputation: 36
I don't quite understand why you can't use ntp.

To set time on a machine you should use ntpdate. It will work despite the time difference between machines.
 
Old 01-12-2012, 01:58 AM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Quote:
Originally Posted by rodrifra
I don't quite understand why you can't use ntp
He may not have internet access on the group of machines he's trying to work with. Maybe he does not have administrative privileges to install software (and NTP is not already installed). Maybe there is an outgoing firewall blocking everything but specific ports (and NTP is not "approved"). There could be any number of reasons.

That said... anyone can create their own internal time server with NTP. NTP clients do not need to sync with an external master time server. They can synchronize with an internal server. Obviously, this would require admin privileges to install software.

If NTP is still not an option, a custom client-server app is all that I can think of. Write a server application that listens for connections. Once a connection is made, send the server's time. On the client end, read the time, and set the local system's time to that value. If it's a relatively traffic-free network, the requests should happen and resolve quickly enough to provide the "few seconds" worth of tolerance. It shouldn't be that difficult with any practical programming experience.

If the OP cannot install software of any kind, then I don't think there's really any combination of standard utilities to handle this. Cron only spawns once per minute.
 
Old 01-12-2012, 05:20 AM   #4
boomboom
LQ Newbie
 
Registered: Jul 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
Our network is private and not connected to internet. Therefore, it need set NTP daemon server on local machine (server). It default not start NTP and I also cannot find ntp.conf file. Maybe need reinstall some software.
Although, I have root password, but boss not prefer us to change the configure OS. Because any mistake will generate great problem and may loss all the data. We don't have data backup system on server.
 
Old 01-12-2012, 08:23 AM   #5
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 202

Rep: Reputation: 36
Depending on your distro, you will have a command to search if a package is installed, use it to see if ntp is in your system, allthough it seems not to be.

If you don't have it, you can get it and all the packages related from any place where you can have Internet connection and take them to that network in a pen drive or whatever device you could use for the job. Install them in your machines and set it up.

If you are not allowed to install software in those machines you will probably not be able to solve your problem, because creating a program seems not an option if you have not installed any compiler in those machines.

The best would be to install ntp, but in case you won't be able to do that, a dirty, not elegant, not precise jet easy way to solve your problem with your available tools would be to create a script that ssh every now and then to the rest of the machines and changes the hour (script will only be running in one machine). Something like

Code:
#!/bin/bash

for i in user1@machine.one user2@machine.two ...... userX@machine.X
do
    time=`date +%m%d%H%M.%S`
    ssh $i << end
        /bin/date $time
        bye
end
done
That way, machine running script will be the one that provides time to the rest. You are supposed to have public key from machine running the script in the other users ~/.ssh/authorized_keys in every machine to allow ssh conection with private/public keys.

Put your script in a cron job running as much as you want, that way you will lose almost no seconds between machines. Your networks time error will be that of machine running the script plus as much as a few seconds (the time it takes to ssh and change date in the other machines).

Last edited by rodrifra; 01-12-2012 at 08:24 AM.
 
Old 01-12-2012, 04:59 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
As stated I would think that NTP synced to the servers own clock would be the easiest. Another time sync service that might already be installed depending on the distribution is time-stream (tcp) and time-dgram (udp). It runs from xinetd and the client utility is rdate. You can run rdate via rc.local or equiv and/or a cron job.
 
Old 01-12-2012, 08:08 PM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by boomboom View Post
Our network is private and not connected to internet. Therefore, it need set NTP daemon server on local machine (server). It default not start NTP and I also cannot find ntp.conf file. Maybe need reinstall some software.
Although, I have root password, but boss not prefer us to change the configure OS. Because any mistake will generate great problem and may loss all the data. We don't have data backup system on server.
Who are the administrators?? Anyone who doesn't have a backup of a production server, is ASKING for trouble.

Also, you don't need an internet connection to run NTP...just a cheap, USB connected GPS receiver. I wrote up procedures that will work just fine:
http://www.linuxquestions.org/questi...th-gps-824129/

This is for a Bluetooth GPS receiver, but as it says in that thread, just replace the rfcommxx device with ttyUSBxx, fire up GPSD, and you're all set. Point everything else on your private network to that server and enjoy.
 
Old 01-12-2012, 08:28 PM   #8
boomboom
LQ Newbie
 
Registered: Jul 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thanks rodrifra.

Besides, I found we have rdate, but it report connection refused. At least I can find /etc/xinetd.d/time-stream, I will search the web to find how to start the service. Thansk michaelk.

P.S.
We have no "system administrator", everything just do by ourselves (user). All of us are not familiar the work, therefore we try to keep all OS configure, we just install new EAD tools and license. Time different made us cannot get the license. In past, I need do 10 times "date -s xxxxx", such that set the time same as the server.
 
Old 01-12-2012, 08:38 PM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by boomboom View Post
Thanks rodrifra.
Besides, I found we have rdate, but it report connection refused. At least I can find /etc/xinetd.d/time-stream, I will search the web to find how to start the service. Thansk michaelk.

P.S.
We have no "system administrator", everything just do by ourselves (user). All of us are not familiar the work, therefore we try to keep all OS configure, we just install new EAD tools and license. Time different made us cannot get the license. In past, I need do 10 times "date -s xxxxx", such that set the time same as the server.
If you have to ask who the systems administrator is, then it's YOU. If you're doing it all yourselves, you should at the very least, make backups. If you can't figure it out, hire a consultant for a day to get some sort of backup system in place, and to configure NTP.

You don't say what version/distro of Linux you're using, but if you follow the thread I posted before, you can have NTP up and running easily. Even if you have to download a package or two from another system, and put them on a USB stick to take to your 'private' network.
 
Old 01-12-2012, 09:01 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
It would help to know what distribution you are running. The services need to be enabled and xinetd started. I would agree with TB0ne that setting up a NTP server with GPS is not difficult.
 
1 members found this post helpful.
Old 01-12-2012, 09:16 PM   #11
boomboom
LQ Newbie
 
Registered: Jul 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
I will try it in free time.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NTP time sync with windows 2000 AD time csghosh Linux - Enterprise 7 02-24-2012 03:46 PM
NTP sync time issue... smartyshan Linux - Server 5 06-23-2009 02:37 AM
NTP sync up time sidra Linux - Networking 1 09-27-2007 09:07 PM
Sync KDE/System Time w/ NTP carlosinfl Linux - General 6 03-15-2006 03:37 PM
ntp time sync eyewittness Linux - Networking 2 08-11-2004 09:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration