2007-08-21-shell-script-scripts-to-restart-firefox.md 1.06 KB
Newer Older
Danesh Manoharan's avatar
Danesh Manoharan committed
1
2
---
title: Shell script scripts to restart firefox
3
author: Danesh Manoharan
Danesh Manoharan's avatar
Danesh Manoharan committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
date: 2007-08-20T22:30:23+00:00
pvc_views:
  - 9069
dsq_thread_id:
  - 889737502

---
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`  
>  `#`  
>  `#```  
>  `#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.