help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Getting PID


From: Danny
Subject: Re: [Help-bash] Getting PID
Date: Fri, 1 Jan 2016 07:22:11 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

Good question ...

This is what I want to do ... I have 2 apps that I want to use at the same time
... problem is that both of them puts a lock on /dev/ttyS1 ... needless to say I
cannot use both of these apps together ... what is funny though is that gtkterm
(one of the apps) actually compliments or enhances the use of the other app
(Xastir) ...

With gtkterm I am able to inject data into /dev/ttyS1 IF and only IF Xastir is
not active ...

So currently I am manually doing this ... Startup Xastir ... when I need to
inject data into /dev/ttyS1 I close Xastir ... open gtkterm and inject the data
... close gtkterm ... start Xastir ... a vicious circle ...

So I was thinking ... :
-Start Xastir
-Get PID of Xastir (or even better ... get contents of /var/lock/LCK..ttyS1) and
store it into a BASH variable (Xastir always returns 3 PID's and the last one is
always found in /var/lock/LCK..ttyS1)...
-Start gtkterm
-get gtkterm's PID and pipe it into /var/lock/LCK..ttyS1
-send the required data to /dev/ttyS1
-get Xastir's PID (that was stored in a BASH variabl) and write it back into
/var/lock/LCK..ttyS1
-And all should be well ... but it isn't ...

Somehow ... even though I start gtkterm after Xastir and gtkterm's PID is inside
the lock file ... gtkterm is a zombie ... I cannot inject the data I want ... it
is as if Xastir is still in control of /var/lock/LCK..ttyS1 ...

I hope I am making sense

Danny

On Dec 29 15, Greg Wooledge :
> To: address@hidden
> Date: Tue, 29 Dec 2015 07:43:44 -0500
> From: Greg Wooledge <address@hidden>
> Subject: Re: [Help-bash] Getting PID
> User-Agent: Mutt/1.4.2.3i
> X-BeenThere: address@hidden
> 
> On Sun, Dec 27, 2015 at 11:17:06AM +0200, Danny wrote:
> > I have an application that returns 3 PID's when I do "pidof" ... how would 
> > I get
> > only the last PID returned ...
> > 
> > address@hidden:pidof application
> > 47223 47229 48101
> 
> What makes you think the last PID is the one you want to use in your
> script?  How would your script act in this case:
> 
> address@hidden: pidof application
> 14 32765 32767



reply via email to

[Prev in Thread] Current Thread [Next in Thread]