Running firefox on multiple machines sharing NFS disk space
Firefox, at least recent versions, is braindead when it comes to running on multiple machines sharing the same NFS space (as is the case for our network). This is a fault with firefox and a widely reported bug but the firefox dev team seem determined to do nothing about it. Konqueror and Epiphany handle this situation very well and the fix isn't difficult so it is a mystery to me why such a useful feature has been removed from firefox.
Anyway if you don't want to / can't use Konqueror or Epiphany here is a half way house fix that does pretty much what you want. Save the script below (GPL) and call it netfox. Instead of running firefox run netfox (change what your firefox icons do). Provided you use this instead of firefox directly it will detect firefox running on a remote machine and optionally remote kill it so you can run firefox locally (with all your tabs restored).
To remote kill you'll need to setup ssh keys between your remote machines. I should have finished the script by making it all automatic but I got this far and it serves me well enough for me to stop tinkering with it.
#!/bin/sh
# (c) GPL Matt Clark 2011
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