Shell script scripts to restart firefox

21 Aug, 2007  |  Posted by Danesh  |  in Linux

My Firefox freezes up when I have too many flash videos loading at the same time. Wrote a simple script to restart Firefox every time this happens.

#!/bin/bash
#simple script to kill and restart firefox
#20th August 2007
#Writen by Danesh aka Danny
#http://thedaneshproject.com
#
#look for the firefox PID
PID=`ps -ef | grep firefox-bin | grep -v grep | awk ‘{print $2}’`
#locate firefox executable
FIRE=`which firefox`
#kill firefox
CMD=�kill -9 $PID�
`$CMD`
#pause for 2 seconds
`sleep 2`
#start firefox
CMD=�$FIRE�
`$CMD &`
#End of script

I will be adding more functionality to the script in the future. Once sure feature will be the ability to choose either to kill all running instances or just kill a specific instance.

  • Digg
  • del.icio.us
  • BlinkList
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Furl
  • Google
  • Live
  • Facebook
  • Pownce
  • TwitThis
  • E-mail this story to a friend!
Tags: ,

3 Responses so far | Have Your Say!

  1. Albert Kam  |  August 23rd, 2007 at 5:48 pm #

    Great one ! Thanks !

    Albert Kam - Gravatar
  2. Danny  |  August 23rd, 2007 at 7:44 pm #

    Thanks Albert.

    Danny - Gravatar
  3. allaboutblog  |  September 10th, 2008 at 9:43 pm #

    An other way is:

    killall firefox
    firefox

    allaboutblog - Gravatar

Leave a Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>