Monday, June 2, 2014

Firefox - running multiple instances

If you've ever logged on to the same host from two different displays and tried to run Firefox, you will probably have seen:

Firefox is already running but is not responding. To open a new window, you must first close the existing Firefox process or restart your system

It's because two instances of the Firefox application are attempting to share ~/.mozilla/firefox/some-default-profile. No matter how many combinations of -no-remote and -new-instance I tried, same problem.

Solution: small shell script that creates a new profile each time (we don't need any bookmarks imported or anything, we just want a simple browser to display an HTML page) then deletes it afterwards:



TEMP_PROFILE=`mktemp -d`
$FIREFOX -CreateProfile "$PROFILE_NAME $TEMP_PROFILE" 2>/dev/null

Tested and working on Linux and Solaris 10. The idea came from here but I couldn't get to the shell script from that post (busted link?) but I figured this was probably what he/she meant :-)