Wednesday, September 9, 2009

Script to Unlock Firefox

I wrote a script to unlock Firefox on a linux machine. The symptom is when firefox is not running, but it won't let you start because it thinks it's still running. If you have already run "pkill -9 –f firefox", then all you have to do is delete the lock files -- .parentlock, and lock.

This is user specific, so you'll have to find your own home directory under ~/.mozilla/firefox/. Mine is dz4bq7je.scottm on this host.

$ cat ~/bin/unlock_firefox.sh
#!/bin/sh
rm ~/.mozilla/firefox/dz4bq7je.scottm/.parentlock
rm ~/.mozilla/firefox/dz4bq7je.scottm/lock
$ ll ~/.mozilla/firefox/
total 12
drwx------ 9 scottm users 4096 Sep 9 11:25 dz4bq7je.scottm
-rw------- 1 scottm users 1264 Jun 23 2008 pluginreg.dat
-rw-r--r-- 1 scottm users 162 Nov 15 2005 profiles.ini
$

The advantage of this simple script is that you don't have to go looking for directories and files, or remember where firefox puts them. Just remember when it's locked, look for your unlock script.

No comments: