Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.