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

Re: Bypassing lock files



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlZ2nGwACgkQBcgs9XrR2kaP9wCfdaAYxweJcfm7Ubw64DyP+R7W
234AniB25LwQiThcCrKWO1wyg+Z7kiED
=LUbF
-----END PGP SIGNATURE-----


Reply to: