[comp.unix.questions] Time Syncing

guy@library.calpoly.edu (Guy Martin) (03/11/91)

I have a problem I am hoping someone out there can give me some help on.
I am trying to sync our system time (Symmetry 27) with another local
host.  I have tried using a shell script I wrote that simply telnets
to the said host's telnet port 13 to return their time stamp.  This
works fine when I run it as root from a terminal.  However, cron
spits it out as telnet requires a controlling tty to be present to
execute correctly.

I have also tried using ntpd (from gatekeeper.dec.com), but due to
an older version of Dynix, we don't have 'adjtime', which ntpd
requires to adjust the time.  Also, we don't have some mundane
little things like getopt and the like.  

So, my question is : "what other alternatives do I have?".  Is there 
something that I am overlooking?  Thanks in advance.

	-Guy
-- 
Guy Martin -- UNIX Systems Support         | Internet: guy@library.calpoly.edu
Robert E. Kennedy Library, Cal Poly SLO    | UUCP: voder!polyslo!library!guy
----------------------------- Standard Disclaimer -----------------------------
  My opinions are my own!  They do not reflect those of the Kennedy Library.

jik@athena.mit.edu (Jonathan I. Kamens) (03/11/91)

In article <27daccc2.539b@petunia.CalPoly.EDU>, guy@library.calpoly.edu (Guy Martin) writes:
|> I have a problem I am hoping someone out there can give me some help on.
|> I am trying to sync our system time (Symmetry 27) with another local
|> host.  I have tried using a shell script I wrote that simply telnets
|> to the said host's telnet port 13 to return their time stamp.  This
|> works fine when I run it as root from a terminal.  However, cron
|> spits it out as telnet requires a controlling tty to be present to
|> execute correctly.

  1) You can write a program to connect to port 13 on the remote host and get
the time string; using telnet is overkill.  Then you avoid the problem of
telnet requiring a tty to run on.  If you don't want to write the program, we
have one at Athena for which I can send you the sources, although I don't
guarantee it'll compile on your system.

  2) You can use the "pty" package to get telnet to run from cron.  Available
at a comp.sources.unix archive site near you.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710