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

Re: Bypassing lock files



Thanks Tomas ... seems like I have some reading to do ... ;) ...

On Dec 20 15, tomas@tuxteam.de :
> To: debian-user@lists.debian.org
> Date: Sun, 20 Dec 2015 13:17:48 +0100
> From: tomas@tuxteam.de
> Subject: Re: Bypassing lock files
> User-Agent: Mutt/1.5.21 (2010-09-15)
> X-Loop: debian-user@lists.debian.org
> 
> On Sun, Dec 20, 2015 at 12:00:39PM +0200, Danny wrote:
> > Hi,
> > 
> > I have an application that uses /dev/ttyS1 and creates a lock file in /var/lock
> > ... however I need to inject extra data into /dev/ttyS1 via a bash script ...
> > 
> > How would I go about "bypassing" the lock file in order for this script to
> > inject the data?
> 
> The lock is not mandatory, it's there just to support well-behaved applications.
> You can echo, cat, cp... whatever into /dev/ttyS1. That said, it's then your
> responsibility to ensure you're getting the results you expect.
> 
> Two applications writing into the same tty end up shuffling their output in
> some semi-random way.
> 
> Things to look out: check that the other application is (somehow) in a
> quiescent state and that it has flushed its output buffer to some sensible
> point (and isn't in the middle of something, e.g. a line or whatever).
> 
> A more robust way of injecting things might be a filter which accepts the
> input of your application, injects its stuff at appropriate "places" in the
> stream and sends the combined stream to ttyS1. But it might be more work
> too (but it might be as simple as sed/awk/perl/...).
> 
> Regards
> -- tomás


Reply to: