Comment 162 for bug 93546

Revision history for this message
In , Dav1dblunk3tt (dav1dblunk3tt) wrote :

Revised script that provides the required functionality until a proper fix is supplied.

Basically logs where firefox is running and will remotely kill ff allowing it to be restarted locally (and ff recovers the session). Requires kde / ssh keys to be setup to work.

#!/bin/sh
HN=`hostname`

echo hostname set to $HN
if test -e ~/.mozilla/firefox/lock_host ; then
        LM=`cat ~/.mozilla/firefox/lock_host`
        echo Firefox has taken a lock out on the following machine:
        cat ~/.mozilla/firefox/lock_host
        if [ "$LM" = "$HN" ] ; then
                echo Running a repeat firefox
                /usr/bin/firefox
                exit
        else
                #ANS=`kdialog --yesno "Firefox is locked on machine $LM \n Do you wish me to try to kill it?"`
                kdialog --yesno "Firefox is locked on machine $LM \n Do you wish me to try to kill it?"
                #ANS=$?
                #cho "Debug, ANS=$ANS"
                if [ $? = 0 ]; then
                #if test yes = $ANS ; then
                        echo "Trying to kill the remote firefox"
                        #RES=`ssh -o "StrictHostKeyChecking no" $LM "killall -regexp firefox"`
                        echo "No result" > /tmp/.netfoxsshres
                        ssh -o "StrictHostKeyChecking no" $LM "killall -regexp firefox" 2> /tmp/.netfoxsshres
                        RES=`cat /tmp/.netfoxsshres`
                        rm -f /tmp/.netfoxsshres
                        kdialog --msgbox "Result was $RES, now try again"

                        else
                                exit
                        fi
                exit
                fi
        fi

echo No lock_host detected
echo Making lock_host
touch ~/.mozilla/firefox/lock_host
echo $HN >> ~/.mozilla/firefox/lock_host
date >> ~/.mozilla/firefox/lock_host.log
echo $HN >> ~/.mozilla/firefox/lock_host.log
#uname -n > ~/.mozilla/firefox/lock_host

echo Running firefox
/usr/bin/firefox $1 $2 $3 $4 $5
echo Removing lock_host
rm -f ~/.mozilla/firefox/lock_host
date >> ~/.mozilla/firefox/lock_host.log