My Location Message Board E-Mail
pcbypaul
pc software, repair
      return to
    Homepage
bg

 
WP Clipart

Not Just for Geeks Anymore
Scripts 'N Tips
Xterm Use
Firefox Updating
update Java
Firefox Keys
Themes offline
Start Firefox
Kill Firefox
Firefox 16x16
Firefox Problems
Compiling
Compile wxPython
Disk Usage
CD Player
cdArray
Find-Installed
Backgrounds
Gimp Splash
Links
LinuxPackages
IceWalkers
Freshmeat
Linux Today
Slashdot



Script to kill Firefox

Even the best browser can lock-up on occassion . . .


due to malicious code, overwhelmed plug-in, whatever. When that happens on Linux you may be tempted to "kill" Firefox, but if you do, starting FF back up gives you that dreaded "log in under a different profile" option. The reason is a lock file present in your user directory.

I wrote a litle script that closes any open FF windows, and also deletes that pesky, hanger-on of a lock file if you aren't able to close FF properly.


A couple notes before the script --

  • You need xdialog on your system to use the scripts as-is. If you want to use the scripts without xdialog, just delete the xdialog parts. You won't get a warning or success feedback, but the script will still do the job.

  • To ease use of the script, I make a keybinding to it so I can run it a a moment's notice. I simply add this line
    key "Alt+Ctrl+q"	killFirefox
    
    to my "keys" file under icewm. (/usr/share/icewm/keys) You'd have to see your WM documentation to impliment that in KDE, Gnome, etc.


Stick it in your path


#!/bin/bash
# killFirefox script by Paul Sherman 
# does not just kill firefox-bin, but also removes lock file 
# from user home dir so that firefox can be restarted.
# uses the bash shell and xdialog

DIALOG=Xdialog
$DIALOG	--title "Firefox Destroyer" \
      	--yesno "This script will close any running instances of the Firefox browser.\nDo you wish to continue?" 0 0
	sel=$?
	case $sel in
		0) echo "Firefox will be destroyed.";;
		1) echo "OK, never mind" ; 
		   exit ;;
		255) echo "OK, never mind" ;
		     exit ;;
	esac 
killall firefox-bin
find "$HOME/.mozilla/firefox" -name "lock" -exec rm {} \;
$DIALOG --title "Success..." \
        --msgbox "If any instances of Firefox were open, \nthey are no more." 0 0
exit 0



Tux Pages created and served by Linux Graphics made/edited by the Gimp   Created with the Gimp byPaul