[ale] help please getting script file to work

Michael H. Warfield mhw at WittsEnd.com
Wed Feb 15 17:08:46 EST 2012


On Wed, 2012-02-15 at 14:24 -0500, Jim Kinney wrote:
> add a line at the very beginning of the file as below:

> #!/bin/bash

#!/bin/sh -

If you're not specifically using incompatible bashisms, go with /bin/sh
(which is bash anyways) just as a matter of good practice.  Ends up
doing the same thing, just better practice.

The following dash ('-') is not NEARLY as important on Linux systems as
it is on other flavors of *NIX because SUID scripts are not allowed, but
it's generally a good idea (BCP) to include that '-' and is generally a
standard practice in most "sh/bash/as/ksh" scripts.  There use to be
some old security vulnerabilities on SunOS with SUID scripts where the
'-' was not included, which is where that practice originated.

> better choice to have it start automagically is to write a script modeled
> after the ones in /etc/init.d to set up the gps modem and have that process
> run before the ntpd is started.

Concur.  Create yourself a nice gps-setup script and link it to
99-gps-setup to take care of those things.  Pouring it into rc.local is
an option but not nearly as elegant.

Mike

> On Wed, Feb 15, 2012 at 1:54 PM, Ron Frazier
> <atllinuxenthinfo at c3energy.com>wrote:
> 
> > Hi all,
> >
> > I need to put this script file on my desktop so I can double click it
> > after boot up to initialize my USB GPS.  I haven't studied shell scripts
> > and don't know the proper syntax to make it work.  The log_daemon_msg
> > seems to write on the screen in the /etc/init.d/ntp file, but doesn't
> > work here.  An even better approach would be to have these commands run
> > during initial ntpd startup at boot time, but I don't know how to do that.
> >
> > # script file to stop ntpd, initialize the usb gps, then restart ntpd
> > # Ron Frazier - 2012-02-15
> >
> > # stop ntpd
> > sudo "/etc/init.d/ntp stop"
> >
> > # set up the com port
> > log_daemon_msg "Setting /dev/ttyUSB0 comm parameters."
> > sudo "stty -F /dev/ttyUSB0 57600 igncr clocal -echo -ixon"
> >
> > # set up link to /dev/gps5
> > log_daemon_msg "Creating link to /dev/gps5."
> > sudo "ln -T /dev/ttyUSB0 /dev/gps5"
> >
> > # restart ntpd
> > sudo "/etc/init.d/ntp start"
> >
> > Any help is greatly appreciated.
> >
> > Sincerely,
> >
> > Ron
> >
> >
> > --
> >
> > (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
> >
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://mail.ale.org/mailman/listinfo/ale
> > See JOBS, ANNOUNCE and SCHOOLS lists at
> > http://mail.ale.org/mailman/listinfo
> >
> 
> 
> 
> -- 
> -- 
> James P. Kinney III
> 
> As long as the general population is passive, apathetic, diverted to
> consumerism or hatred of the vulnerable, then the powerful can do as they
> please, and those who survive will be left to contemplate the outcome.
> - *2011 Noam Chomsky
> 
> http://heretothereideas.blogspot.com/
> *
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo

-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
Url : http://mail.ale.org/pipermail/ale/attachments/20120215/55a3251c/attachment.bin 


More information about the Ale mailing list