Re: rc script running twice ???

2011-01-27 Thread Kevin D. Clark

Drew Van Zandt writes:

> /etc/rc2.d/S40init_xuarts start
> root   498  0.0  0.8   2808   504 ttyS0S+   00:00   0:00  \_
> /bin/sh /etc/rc2.d/S40init_xuarts start
> root   500  0.1  0.9   1676   576 ttyS0S+   00:00   0:00  \_
> sed s/ttyname=//

.

> # Barcode
> ln -s -f `/usr/local/bin/xuartctl -d --speed=115200 --mode=7e1 -p 1 2>&1
> |sed s/ttyname=//` /dev/barcode
> # Copleys
> ln -s -f `/usr/local/bin/xuartctl -d --speed=9600 --mode=8n1 -p 2 2>&1 |sed
> s/ttyname=//` /dev/copley
> # Watlows
> ln -s -f `/usr/local/bin/xuartctl -d --speed=38400 --mode=8n1 -p 5 2>&1 |sed
> s/ttyname=//` /dev/watlow


I think that your multiple S40init_xuarts entries in the process table
are a result of the subshells that you are running via `backticks`.

This is the behavior of the shell.

Furthermore, since you are apparently seeing something hang here, I'll
bet that one of your invocations of /usr/local/bin/xuartctl is hanging
somehow.  If it wasn't hanging, then you'd have a very difficult time
seeing this in the process table.

Regards,

--kevin
-- 
alumni.unh.edu!kdc / http://kdc-blog.blogspot.com/
GnuPG: D87F DAD6 0291 289C EB1E 781C 9BF8 A7D8 B280 F24E

 Wipe him down with gasoline 'til his arms are hard and mean
 From now on boys this iron boat's your home
 So heave away, boys.
   -- Tom Waits
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/


Re: rc script running twice ???

2011-01-27 Thread Drew Van Zandt
I've never used the ps f view (yes, I know...how odd); handy.

root   470  1.1  2.4   2992  1516 ttyS0Ss+  00:00   0:00 /bin/sh
/etc/init.d/rc 2
root   496  0.1  1.9   2808  1232 ttyS0S+   00:00   0:00  \_ /bin/sh
/etc/rc2.d/S40init_xuarts start
root   498  0.0  0.8   2808   504 ttyS0S+   00:00   0:00  \_
/bin/sh /etc/rc2.d/S40init_xuarts start
root   500  0.1  0.9   1676   576 ttyS0S+   00:00   0:00  \_
sed s/ttyname=//

root   502  0.0  0.4   1712   308 ?Ss   00:00   0:00
/usr/local/bin/xuartctl -d --speed=115200 --mode=7e1 -p 1
root   503  0.0  0.3   1720   244 ?Ss   00:00   0:00
/usr/local/bin/xuartctl -d --speed=115200 --mode=7e1 -p 1

Note the -d daemonizes xuartctl in the script below:
ts7500:/etc/init.d# more init_xuarts.sh
#!/bin/sh
# Server for all first.
xuartctl -d
# Barcode
ln -s -f `/usr/local/bin/xuartctl -d --speed=115200 --mode=7e1 -p 1 2>&1
|sed s/ttyname=//` /dev/barcode
# Copleys
ln -s -f `/usr/local/bin/xuartctl -d --speed=9600 --mode=8n1 -p 2 2>&1 |sed
s/ttyname=//` /dev/copley
# Watlows
ln -s -f `/usr/local/bin/xuartctl -d --speed=38400 --mode=8n1 -p 5 2>&1 |sed
s/ttyname=//` /dev/watlow


On Thu, Jan 27, 2011 at 3:21 PM, Joshua Judson Rosen
wrote:

> Drew Van Zandt  writes:
> >
> > Debian Linux (embedded), I'm in runlevel 2, and I'm seeing this when I
> run ps
> > aux:
> >
> > root   496  0.0  1.9   2808  1232 ttyS0S+   00:00   0:00 /bin/sh
> /etc/
> > rc2.d/S40init_xuarts start
> > root   498  0.0  0.8   2808   504 ttyS0S+   00:00   0:00 /bin/sh
> /etc/
> > rc2.d/S40init_xuarts start
> >
> > S40init_xuarts is a script of mine that I just put in /etc/init.d/ and
> linked
> > from rc2.d.
> >
> > Why is it running twice?
>
> Can you do this again, but with "ps faux" instead--to capture the
> process-hierarchy?
>
> --
> "Don't be afraid to ask (λf.((λx.xx) (λr.f(rr."
>



-- 
*
Drew Van Zandt
Cam # US2010035593 (M:Liam Hopkins R: Bastian Rotgeld A:Walton Shipley)
*Artisan's Asylum Craft Lead, Electronics & Robotics
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/


Re: rc script running twice ???

2011-01-27 Thread Joshua Judson Rosen
Drew Van Zandt  writes:
>
> Debian Linux (embedded), I'm in runlevel 2, and I'm seeing this when I run ps
> aux:
> 
> root       496  0.0  1.9   2808  1232 ttyS0    S+   00:00   0:00 /bin/sh /etc/
> rc2.d/S40init_xuarts start
> root       498  0.0  0.8   2808   504 ttyS0    S+   00:00   0:00 /bin/sh /etc/
> rc2.d/S40init_xuarts start
> 
> S40init_xuarts is a script of mine that I just put in /etc/init.d/ and linked
> from rc2.d.
> 
> Why is it running twice?

Can you do this again, but with "ps faux" instead--to capture the
process-hierarchy?

-- 
"Don't be afraid to ask (λf.((λx.xx) (λr.f(rr."

___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/


Re: rc script running twice ???

2011-01-27 Thread Drew Van Zandt
Two distinct copies; when I run it from the command line, it backgrounds the
services I'm trying to start, and works quite well.  I do know that if one
runs the script twice in parallel (e.g. start a second copy before the first
finishes) that they both hang and never finish.  (There are also two
identical copies of one of the commands in the script in the process table,
hung and waiting).  Everything the script runs is run as a daemon.  (They do
need to be started in order, though hardware init for 8 UARTS
implemented in an FPGA.)

--DTVZ

On Thu, Jan 27, 2011 at 2:38 PM, Kyle Smith  wrote:

> On Thu, Jan 27, 2011 at 2:26 PM, Drew Van Zandt 
> wrote:
>
>> Debian Linux (embedded), I'm in runlevel 2, and I'm seeing this when I run
>> ps aux:
>>
>> root   496  0.0  1.9   2808  1232 ttyS0S+   00:00   0:00 /bin/sh
>> /etc/rc2.d/S40init_xuarts start
>> root   498  0.0  0.8   2808   504 ttyS0S+   00:00   0:00 /bin/sh
>> /etc/rc2.d/S40init_xuarts start
>>
>> S40init_xuarts is a script of mine that I just put in /etc/init.d/ and
>> linked from rc2.d.
>>
>> Why is it running twice?  I've gone through the first page of
>> possibilities from a google search, I'm hoping one of you can point out my
>> obvious silly mistake,
>>
> since I'm blanking.
>>
>
> Is 496 the parent of 498, or are they two distinct copies?  If so, it's
> probably because it starts with #!/bin/sh.
>
> Typically your S* scripts should exec and background whatever service
> you're trying to start, not stay running once the system is loaded.
>  Otherwise ps aux would be full of S* scripts.  You might want to look at
> start-stop-daemon in Debian.
>
> - Kyle
>
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/


Re: rc script running twice ???

2011-01-27 Thread Kyle Smith
On Thu, Jan 27, 2011 at 2:26 PM, Drew Van Zandt wrote:

> Debian Linux (embedded), I'm in runlevel 2, and I'm seeing this when I run
> ps aux:
>
> root   496  0.0  1.9   2808  1232 ttyS0S+   00:00   0:00 /bin/sh
> /etc/rc2.d/S40init_xuarts start
> root   498  0.0  0.8   2808   504 ttyS0S+   00:00   0:00 /bin/sh
> /etc/rc2.d/S40init_xuarts start
>
> S40init_xuarts is a script of mine that I just put in /etc/init.d/ and
> linked from rc2.d.
>
> Why is it running twice?  I've gone through the first page of possibilities
> from a google search, I'm hoping one of you can point out my obvious silly
> mistake,
>
since I'm blanking.
>

Is 496 the parent of 498, or are they two distinct copies?  If so, it's
probably because it starts with #!/bin/sh.

Typically your S* scripts should exec and background whatever service you're
trying to start, not stay running once the system is loaded.  Otherwise ps
aux would be full of S* scripts.  You might want to look at
start-stop-daemon in Debian.

- Kyle


>
> --
> *
> Drew Van Zandt
> Artisan's Asylum Craft Lead, Electronics & Robotics
> *
>
> ___
> gnhlug-discuss mailing list
> gnhlug-discuss@mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
>
>
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/