Firefox kill script.

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post please read how to get help
User avatar
allforcarrie
Level 2
Level 2
Posts: 86
Joined: Tue Apr 17, 2007 2:40 pm
Location: Abilene TX
Contact:

Firefox kill script.

Postby allforcarrie » Wed Jul 04, 2007 5:58 pm

I fond a site htat has a kill script for locked firefox processes. is there any way i can make an icon on my desktop or a launcher so i can run this when i need it?
http://www.pcbypaul.com/linux/firefox_kill.html

Code: Select all

#!/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

Husse
Level 23
Level 23
Posts: 19593
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Postby Husse » Thu Jul 05, 2007 2:02 pm

Nice script
One way of doing it is as follows
Make a new file on your desktop and call it killFirefox
Right click on the file and open properties
Open the tab Permissions (hopefully it's called that I'm on a localized Mint)
Tick the box "Run Allow the file to tun as a program"
Copy the file to usr/bin
sudo cp killFirefox /usr/bin/killFirefox
Right click on the dekstop and create a program starter for your killFirefox
When you double click the starter you're asked if you want to kill Firefox.
//Edit/Use the script with zenity instead - zenity is already installed see two posts below/
If you don't have xdialog installed you need to install it first. (you'll find it in synaptics)
Thsi could of course be done in the CLI but I prefer the GUI as long as possible (mostly)
Last edited by Husse on Fri Jul 06, 2007 6:15 am, edited 1 time in total.
Image
Don't fix it if it ain't broken, don't break it if you can't fix it

User avatar
rfruth
Level 1
Level 1
Posts: 47
Joined: Mon Jan 15, 2007 11:53 am
Location: Texas (USA)
Contact:

Postby rfruth » Thu Jul 05, 2007 6:28 pm

Thanks ! This should come in handy, I have the flash issue https://bugs.launchpad.net/ubuntu/+source/flashplugin-nonfree/+bug/98688

User avatar
HackingYodel
Level 1
Level 1
Posts: 7
Joined: Tue Jun 26, 2007 2:04 am
Contact:

Postby HackingYodel » Thu Jul 05, 2007 8:32 pm

If you are running gnome based Mint try this:

Code: Select all

#!/bin/bash
# kill hung Firefox programs (HackingYodel's version of Paul Sherman's
# work)
# kills firefox-bin and removes lock files
# from user's home dir so that firefox can be restarted
# uses the bash shell and zenity

TITLE="Fox Kill"
KILLTEXT="Kill ALL running firefox programs now?"
DEAD="Ding Dong! The Fox is dead."
RESULT="You got 'em"
NOTHING="That was easy"
EASY="I didn't touch anything!"

zenity --question --title="$TITLE" --text="$KILLTEXT"

if [ $? == 0 ]
   then killall firefox-bin
       find "$HOME/.mozilla/firefox" -name "lock" -exec rm {} \;
       zenity --info --title="$RESULT" --text="$DEAD"
   else zenity --info --title="$NOTHING" --text="$EASY"
fi
exit 0


This uses zenity, which is installed by default I think, to produce a native gnome gui. Set it up just like the other script and feel free to ask me any questions about it.
My new blog http://freeandpriceless.blogspot.com/

Linux and BSD user since 1999.


Return to “Other topics”

Who is online

Users browsing this forum: No registered users and 1 guest