<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi Andrew and others,<br>
<br>
Thanks for the replies on this thread. I actually have my script
mostly working now in the incarnation directly below when I double
click it from the desktop. I haven't gotten around to trying to auto
boot it yet. I could have posted this question on the NTP questions
list at ntp.org, however it was more of a Linux specific thing so I
posted it here. I've been throwing a bunch of other questions at them
anyway.<br>
<br>
Two things were keeping my script from not working at all, which are
now fixed:<br>
<br>
The absence of this line: #!/bin/bash, which I'll probably change to
#!/bin/sh - as Mike W. suggested. I have no idea what this does!
Looks like a comment to me.<br>
<br>
Also, I had quotes around all the commands, which the system didn't
like.<br>
<br>
I posted a thread with this subject yesterday: "how I did Ubuntu + NTPD
+ GPS, but how do I keep it?" All of my saga is described there. In
answer to your question, my GPS is a GlobalSat BU-353 and I'm running
Ubuntu 11.04.<br>
<br>
Like I said, the script is essentially working. It's whole purpose is
to stop NTPD, initialize the USB com port for the GPS, then restart
NTPD. I know that the GPS works once that's done.<br>
<br>
Right now, I'm having a problem that's driving me insane. Here's an
NTPQ printout before running my script. Notice that the computer is
synchronized closely to the time servers and there is no GPS. The top
server is the current clock.<br>
<br>
<tt>ron@asus-k52f-1:/etc$ ntpq -p<br>
remote refid st t when poll reach delay offset
jitter<br>
==============================================================================<br>
*nist1-ny.ustimi .ACTS. 1 u 118 128 377 54.015 -3.923
10.731<br>
-216.119.63.113 .ACTS. 1 u 63 128 377 55.535
12.876 3.762<br>
+india.colorado. .ACTS. 1 u 61 128 377 60.914
-7.932 2.995<br>
+ping-audit-207- .ACTS. 1 u 126 128 277 84.008
-6.617 5.344<br>
</tt><br>
Then, I run the script. Here is the NTPQ printout shortly after
running the script:<br>
<br>
<tt>ron@asus-k52f-1:/etc$ ntpq -p<br>
remote refid st t when poll reach delay offset
jitter<br>
==============================================================================<br>
*GPS_NMEA(5) .GPS1. 0 l 3 8 377 0.000 595.804
88.950<br>
nist1-ny.ustimi .ACTS. 1 u 8 64 7 55.065 570.579
52.070<br>
216.119.63.113 .ACTS. 1 u 6 64 7 55.089 594.824
44.885<br>
india.colorado. .ACTS. 1 u 7 64 7 60.848 633.795
63.543<br>
ping-audit-207- .ACTS. 1 u 10 64 7 85.777 576.470
45.730<br>
</tt><br>
Now, the GPS has appeared, so I know the USB com port is working.
However, now my clock is ~ 500 ms off from ALL the servers including
the GPS. I have the time coming from the GPS fudged so it closely
matches the NIST servers. So, I don't really think this is related to
the GPS, per se, but NTPD is going bonkers or NTPQ is going bonkers.
All I know is I'm going bonkers and I cannot figure out where this
instant offset is coming from.<br>
<br>
On Windows, using a recent version of the Windows port of NTPD from
Dave Hart's website, I can stop the service with it closely
synchronized with either the GPS or the internet servers, tinker with
the configuration, and restart NTPD and it picks up right where it left
off, with almost no additional offset at all. I MAY have seen it do
this once or twice in Windows, but I can't remember for sure. The
restart sequence at the bottom of my script is supposed to clear up the
problem, and that seems to work sometimes when I do it manually.<br>
<br>
I don't know what's going on here. Anybody have any clues? Thanks for
all the help.<br>
<br>
By the way, I'd also like to know how to make my script print things on
the screen as it progresses through. In DOS, I'd use ECHO, but I don't
know the command here.<br>
<br>
Sincerely,<br>
<br>
Ron<br>
<br>
<br>
---------------------------<br>
<br>
Current version of my script file.<br>
<br>
<tt>#!/bin/bash<br>
<br>
# script file to stop ntpd, initialize the usb gps, then restart ntpd<br>
# Ron Frazier - 2012-02-15<br>
<br>
# stop ntpd<br>
sudo /etc/init.d/ntp stop<br>
<br>
# set up the com port<br>
log_daemon_msg "Setting /dev/ttyUSB0 comm parameters."<br>
sudo stty -F /dev/ttyUSB0 57600 igncr clocal -echo -ixon<br>
<br>
# set up link to /dev/gps5<br>
log_daemon_msg "Creating link to /dev/gps5."<br>
sudo ln -T /dev/ttyUSB0 /dev/gps5<br>
<br>
# set the clock<br>
sudo ntpdate -b nist1-ny.ustiming.org<br>
<br>
# start ntpd<br>
sudo /etc/init.d/ntp start<br>
<br>
# wait 5 seconds<br>
sleep 5<br>
<br>
# ---- cycle ntpd again<br>
<br>
# stop and restart ntpd<br>
sudo /etc/init.d/ntp restart<br>
<br>
# wait 5 seconds<br>
sleep 5<br>
</tt><br>
<br>
<br>
On 02/15/2012 07:43 PM, Andrew Wade wrote:
<blockquote
cite="mid:CACUD18ouZ6As7kmt=ZequY62D6-MoG3Dcqf6=pX1ghJH0pn5dw@mail.gmail.com"
type="cite">Can you tell us the model of the USB GPS device? I see
some other posts about that same command:
stty -F /dev/ttyUSB0 57600 igncr clocal -echo -ixon
<div><br>
</div>
<div>I want to understand which commands you are using are working or
not (or if you just grabbed them from another source and tried to do
the same thing in a different Linux OS with no luck)</div>
<div><br>
</div>
<div>Also, what Linux are you using?<br>
<br>
<div class="gmail_quote">On Wed, Feb 15, 2012 at 5:08 PM, Michael H.
Warfield <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:mhw@wittsend.com">mhw@wittsend.com</a>></span> wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Wed, 2012-02-15 at 14:24 -0500, Jim Kinney wrote:<br>
> add a line at the very beginning of the file as below:<br>
<br>
> #!/bin/bash<br>
<br>
</div>
#!/bin/sh -<br>
<br>
If you're not specifically using incompatible bashisms, go with /bin/sh<br>
(which is bash anyways) just as a matter of good practice. Ends up<br>
doing the same thing, just better practice.<br>
<br>
The following dash ('-') is not NEARLY as important on Linux systems as<br>
it is on other flavors of *NIX because SUID scripts are not allowed, but<br>
it's generally a good idea (BCP) to include that '-' and is generally a<br>
standard practice in most "sh/bash/as/ksh" scripts. There use to be<br>
some old security vulnerabilities on SunOS with SUID scripts where the<br>
'-' was not included, which is where that practice originated.<br>
<div class="im"><br>
> better choice to have it start automagically is to write a script
modeled<br>
> after the ones in /etc/init.d to set up the gps modem and have
that process<br>
> run before the ntpd is started.<br>
<br>
</div>
Concur. Create yourself a nice gps-setup script and link it to<br>
99-gps-setup to take care of those things. Pouring it into rc.local is<br>
an option but not nearly as elegant.<br>
<br>
Mike<br>
</blockquote>
</div>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
(PS - If you email me and don't get a quick response, you might want to
call on the phone. I get about 300 emails per day from alternate energy
mailing lists and such. I don't always see new messages very quickly.)
Ron Frazier
770-205-9422 (O) Leave a message.
linuxdude AT c3energy.com
</pre>
</body>
</html>