Revision 20517,
1.4 KB
checked in by rbasch, 21 years ago
(diff) |
Add the xkill-mozilla script to kill all mozilla instances running on the
display, and invoke it at the end of Xsession, prior to destroying tokens,
to prevent a stale lock file being left in place.
|
Line | |
---|
1 | #!/bin/sh |
---|
2 | |
---|
3 | # $Id: xkill-mozilla.sh,v 1.1 2004-06-07 19:10:49 rbasch Exp $ |
---|
4 | |
---|
5 | # Kill all of the Mozilla instances running on this X display. |
---|
6 | |
---|
7 | moz_libdir=/usr/athena/lib/mozilla |
---|
8 | |
---|
9 | ping_mozilla () { |
---|
10 | LD_LIBRARY_PATH=$moz_libdir${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"} \ |
---|
11 | $moz_libdir/mozilla-xremote-client "ping()" > /dev/null 2>&1 |
---|
12 | return $? |
---|
13 | } |
---|
14 | |
---|
15 | killed= |
---|
16 | timeout=3 |
---|
17 | i=0 |
---|
18 | while ping_mozilla ; do |
---|
19 | # Find all windows which plausibly belong to Mozilla. |
---|
20 | for win in `xwininfo -root -tree | awk '/Mozilla/ { print $1; }'` ; do |
---|
21 | # Skip any window we have already tried to kill. |
---|
22 | case $killed in |
---|
23 | *" $win "*) |
---|
24 | continue |
---|
25 | ;; |
---|
26 | esac |
---|
27 | # See if the window has the _MOZILLA_VERSION property set. |
---|
28 | moz_version="`xprop -id $win _MOZILLA_VERSION 2>/dev/null | \ |
---|
29 | sed -n -e 's/.*"\(.*\)"/\1/p'`" |
---|
30 | if [ -n "$moz_version" ]; then |
---|
31 | # Found one. Kill it, add it to the list of killed windows, and |
---|
32 | # go back to the top of the outer loop to check against the new |
---|
33 | # set of windows. |
---|
34 | xkill -id $win > /dev/null 2>&1 |
---|
35 | killed=" $killed $win " |
---|
36 | continue 2 |
---|
37 | fi |
---|
38 | done |
---|
39 | # If we get here, the ping found a running mozilla, but we were unable |
---|
40 | # to find a window which had not already been killed. Wait one second |
---|
41 | # and try again, up to our timeout limit. |
---|
42 | if [ `expr $i \>= $timeout` -eq 1 ]; then |
---|
43 | echo "Unable to kill Mozilla" 1>&2 |
---|
44 | exit 1 |
---|
45 | fi |
---|
46 | sleep 1 |
---|
47 | i=`expr $i + 1` |
---|
48 | done |
---|
49 | |
---|
50 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.