<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<!-- Template generated by Exclaimer Mail Disclaimers on 09:17:19 Thursday, 16 February 2012 -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">P.9c5b04f2-d7f2-4162-8c45-8f717dee1be5 {
        MARGIN: 0cm 0cm 0pt
}
LI.9c5b04f2-d7f2-4162-8c45-8f717dee1be5 {
        MARGIN: 0cm 0cm 0pt
}
DIV.9c5b04f2-d7f2-4162-8c45-8f717dee1be5 {
        MARGIN: 0cm 0cm 0pt
}
TABLE.9c5b04f2-d7f2-4162-8c45-8f717dee1be5Table {
        MARGIN: 0cm 0cm 0pt
}
DIV.Section1 {
        page: Section1
}
</style>
<meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PlaceName" /><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PlaceType" /><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place" /><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName" /><!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]--><style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
pre
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
tt
        {font-family:"Courier New";}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="blue">
<p class="9c5b04f2-d7f2-4162-8c45-8f717dee1be5"></p>
<div class="Section1">
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">+1<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">I’ve seen more than one user have unexpected results because their /bin/sh was a symbolic link to dash rather than bash.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"></span></font></div>
</div>
</div>
<p></p>
<p class="9c5b04f2-d7f2-4162-8c45-8f717dee1be5"> </p>
<p class="9c5b04f2-d7f2-4162-8c45-8f717dee1be5"> </p>
<p class="9c5b04f2-d7f2-4162-8c45-8f717dee1be5"></p>
<div class="Section1">
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">
<hr size="2" width="100%" align="center" tabindex="-1">
</span></font></div>
<p class="MsoNormal"><b><font size="2" face="Tahoma"><span style="font-size:10.0pt;
font-family:Tahoma;font-weight:bold">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma"> ale-bounces@ale.org [mailto:ale-bounces@ale.org]
<b><span style="font-weight:
bold">On Behalf Of </span></b>Jim Kinney<br>
<b><span style="font-weight:bold">Sent:</span></b> Wednesday, February 15, 2012 10:49 PM<br>
<b><span style="font-weight:bold">To:</span></b> <st1:PersonName w:st="on">Atlanta Linux Enthusiasts</st1:PersonName><br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [ale] help please getting script file to work</span></font><o:p></o:p></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt"><o:p> </o:p></span></font></p>
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt">The first line of a file, script, image or other is typically used to indixate what the rest of the file is about or how to use it.<br>
I don't know the history behind the syntax of #!/bin/sh but it won't work without it!<br>
Mike is correct that #!/bin/sh is more generally portable than #!/bin/bash but I often use many bashisms that wont work in csh, ksh, busybox, nash or dash so I got in the habit of being clear on the intended shell to run the script. csh really doesn't play
nicely with bash arrays :-)<o:p></o:p></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt">On Feb 15, 2012 9:28 PM, "Ron Frazier (ALE)" <<a href="mailto:atllinuxenthinfo@c3energy.com">atllinuxenthinfo@c3energy.com</a>> wrote:<o:p></o:p></span></font></p>
<div text="#000000" bgcolor="#ffffff">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt">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 <a href="http://ntp.org" target="_blank">ntp.org</a>, 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>
</span></font><tt><font size="2" face="Courier New"><span style="font-size:10.0pt">ron@asus-k52f-1:/etc$ ntpq -p</span></font></tt><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt><font face="Courier New"> remote refid st t when poll reach delay offset jitter</font></tt><br>
<tt><font face="Courier New">==============================================================================</font></tt><br>
<tt><font face="Courier New">*nist1-ny.ustimi .ACTS. 1 u 118 128 377 54.015 -3.923 10.731</font></tt><br>
<tt><font face="Courier New">-216.119.63.113 .ACTS. 1 u 63 <a href="tel:128%C2%A0%20377%C2%A0%C2%A0%2055.535" target="_blank" value="+12837755535">
128 377 55.535</a> 12.876 3.762</font></tt><br>
<tt><font face="Courier New">+india.colorado. .ACTS. 1 u 61 <a href="tel:128%C2%A0%20377%C2%A0%C2%A0%2060.914" target="_blank" value="+12837760914">
128 377 60.914</a> -7.932 2.995</font></tt><br>
<tt><font face="Courier New">+ping-audit-207- .ACTS. 1 u 126 128 277 84.008 -6.617 5.344</font></tt><br>
</span></font><br>
Then, I run the script. Here is the NTPQ printout shortly after running the script:<br>
<br>
<tt><font size="2" face="Courier New"><span style="font-size:10.0pt">ron@asus-k52f-1:/etc$ ntpq -p</span></font></tt><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt><font face="Courier New"> remote refid st t when poll reach delay offset jitter</font></tt><br>
<tt><font face="Courier New">==============================================================================</font></tt><br>
<tt><font face="Courier New">*GPS_NMEA(5) .GPS1. 0 l 3 8 377 0.000 595.804 88.950</font></tt><br>
<tt><font face="Courier New"> nist1-ny.ustimi .ACTS. 1 u 8 64 7 55.065 570.579 52.070</font></tt><br>
<tt><font face="Courier New"> 216.119.63.113 .ACTS. 1 u 6 64 7 55.089 594.824 44.885</font></tt><br>
<tt><font face="Courier New"> india.colorado. .ACTS. 1 u 7 64 7 60.848 633.795 63.543</font></tt><br>
<tt><font face="Courier New"> ping-audit-207- .ACTS. 1 u 10 64 7 85.777 576.470 45.730</font></tt><br>
</span></font><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 <st1:place w:st="on"><st1:PlaceType w:st="on">port</st1:PlaceType> of
<st1:PlaceName w:st="on">NTPD</st1:PlaceName></st1:place> 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><font size="2" face="Courier New"><span style="font-size:10.0pt">#!/bin/bash</span></font></tt><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><br>
<br>
<tt><font face="Courier New"># script file to stop ntpd, initialize the usb gps, then restart ntpd</font></tt><br>
<tt><font face="Courier New"># Ron Frazier - 2012-02-15</font></tt><br>
<br>
<tt><font face="Courier New"># stop ntpd</font></tt><br>
<tt><font face="Courier New">sudo /etc/init.d/ntp stop</font></tt><br>
<br>
<tt><font face="Courier New"># set up the com port</font></tt><br>
<tt><font face="Courier New">log_daemon_msg "Setting /dev/ttyUSB0 comm parameters."</font></tt><br>
<tt><font face="Courier New">sudo stty -F /dev/ttyUSB0 57600 igncr clocal -echo -ixon</font></tt><br>
<br>
<tt><font face="Courier New"># set up link to /dev/gps5</font></tt><br>
<tt><font face="Courier New">log_daemon_msg "Creating link to /dev/gps5."</font></tt><br>
<tt><font face="Courier New">sudo ln -T /dev/ttyUSB0 /dev/gps5</font></tt><br>
<br>
<tt><font face="Courier New"># set the clock</font></tt><br>
<tt><font face="Courier New">sudo ntpdate -b <a href="http://nist1-ny.ustiming.org" target="_blank">
nist1-ny.ustiming.org</a></font></tt><br>
<br>
<tt><font face="Courier New"># start ntpd</font></tt><br>
<tt><font face="Courier New">sudo /etc/init.d/ntp start</font></tt><br>
<br>
<tt><font face="Courier New"># wait 5 seconds</font></tt><br>
<tt><font face="Courier New">sleep 5</font></tt><br>
<br>
<tt><font face="Courier New"># ---- cycle ntpd again</font></tt><br>
<br>
<tt><font face="Courier New"># stop and restart ntpd</font></tt><br>
<tt><font face="Courier New">sudo /etc/init.d/ntp restart</font></tt><br>
<br>
<tt><font face="Courier New"># wait 5 seconds</font></tt><br>
<tt><font face="Courier New">sleep 5</font></tt><br>
</span></font><br>
<br>
<br>
On 02/15/2012 07:43 PM, Andrew Wade wrote: <o:p></o:p></p>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt">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
<o:p></o:p></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt">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)<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Also, what Linux are you using?<o:p></o:p></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt">On Wed, Feb 15, 2012 at 5:08 PM, Michael H. Warfield <<a href="mailto:mhw@wittsend.com" target="_blank">mhw@wittsend.com</a>> wrote:<o:p></o:p></span></font></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">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<o:p></o:p></span></font></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt">#!/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.<o:p></o:p></span></font></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><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.<o:p></o:p></span></font></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt">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<o:p></o:p></span></font></p>
</div>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt"><br>
<br>
<br>
<o:p></o:p></span></font></p>
<pre><font size="2" face="Courier New"><span style="font-size:10.0pt">-- <o:p></o:p></span></font></pre>
<pre><font size="2" face="Courier New"><span style="font-size:10.0pt"><o:p> </o:p></span></font></pre>
<pre><font size="2" face="Courier New"><span style="font-size:10.0pt">(PS - If you email me and don't get a quick response, you might want to<o:p></o:p></span></font></pre>
<pre><font size="2" face="Courier New"><span style="font-size:10.0pt">call on the phone. I get about 300 emails per day from alternate energy<o:p></o:p></span></font></pre>
<pre><font size="2" face="Courier New"><span style="font-size:10.0pt">mailing lists and such. I don't always see new messages very quickly.)<o:p></o:p></span></font></pre>
<pre><font size="2" face="Courier New"><span style="font-size:10.0pt"><o:p> </o:p></span></font></pre>
<pre><font size="2" face="Courier New"><span style="font-size:10.0pt">Ron Frazier<o:p></o:p></span></font></pre>
<pre><font size="2" face="Courier New"><span style="font-size:10.0pt"><o:p> </o:p></span></font></pre>
<pre><font size="2" face="Courier New"><span style="font-size:10.0pt"><a href="tel:770-205-9422" target="_blank" value="+17702059422">770-205-9422</a> (O) Leave a message.<o:p></o:p></span></font></pre>
<pre><font size="2" face="Courier New"><span style="font-size:10.0pt">linuxdude AT <a href="http://c3energy.com" target="_blank">c3energy.com</a><o:p></o:p></span></font></pre>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><o:p></o:p></span></font></p>
</div>
</div>
<p></p>
<p class="9c5b04f2-d7f2-4162-8c45-8f717dee1be5"><font face="Arial"><font color="fuchsia"><font style="FONT-FAMILY: Arial; FONT-SIZE: 10pt" size="2"></font></font></font> </p>
<p class="9c5b04f2-d7f2-4162-8c45-8f717dee1be5"> </p>
<p class="9c5b04f2-d7f2-4162-8c45-8f717dee1be5"><font face="Arial"><font color="fuchsia"><font style="FONT-FAMILY: Arial; FONT-SIZE: 10pt" size="2">Athena<font size="1">®</font>, Created for the Cause</font><font size="1">™
</font></font></font></p>
<p class="9c5b04f2-d7f2-4162-8c45-8f717dee1be5"><font size="2" face="Arial">Making a Difference in the Fight Against Breast Cancer</font></p>
<p class="9c5b04f2-d7f2-4162-8c45-8f717dee1be5"><span style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"></span> </p>
<p class="9c5b04f2-d7f2-4162-8c45-8f717dee1be5"><span style="FONT-FAMILY: Arial; FONT-SIZE: 10pt">---------------------------------<br>
CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information
is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.<br>
----------------------------------</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt"><o:p></o:p></span></p>
<p> </p>
</body>
</html>