Re: How to kill application when X-Server is terminated



In article <pan.2006.12.22.15.23.03.188751@xxxxxxxxx>,
"Felix E. Klee" <fk@xxxxxxxxx> wrote:

We have the problem that under certain (rather complicated) circumstances,
an X application stays alive forever after the X server has been killed.
It seems that, in this case, an application only gets killed once it tries
to unsuccessfully communicate with the X server. Examples:

* xterm: Never terminates, at least as long as there is no update of the
content within the xterm (I assume that an "xterm" showing the output of
"top" would terminate quickly).

* xclock: Terminates immediately once the X server has been killed.

* xeyes: Stays alive after the X server has been killed, but terminates
once the X server has been started again. This is a special case: Don't
waste your thoughts on it.

Now, we've a TCL/TK application that behaves just like "xterm". How can
we force it to communicate with the X server regularly (so that it gets
killed once the X server dies)?

If you have the command pidof

#!/bin/bash
x=`pidof wish` && kill $x
.