Pages

Unixbhaskar's Blog

Saturday, February 6, 2010

Cleanup Firefox clogging by pruning it's database

I have been running firefox for quite sometime now. And sometime it come down to it's knees to make me frustrated . Yes I must confess that I have had a fatty extensions build into it...but still the performance sometime really down.

So I started to investigate what is the actual cause( might be one of the cause to it) . And after some search in the ocean of internet I found a better solution.

I do not issue any guarantee that this will work for you.

It is all about pruning the firefox own database,which is an sqlite one. Because due to huge bookmarks and thousand of page visits everyday make it cache lot of thing in it's database. So it's really important to once in every second day to get it pruned .

I wrote a small and very trivial script(got the inspiration from Mozillazine web site and their developers) to run it in specified time, either by hand or by cron.

Here is the script....one has to change the path of thir own profile, nothing else has to be done.I gave it a name: ff_databse_cleanup..you can give anything you want :)

1 #!/bin/bash
2 profile_dir="/home/bhaskar/.mozilla/firefox/2zbbd86m.default"
3
4 echo " Killing all running swiftfox instances for database clean up..."
5
6 pkill swiftfox-bin
7
8 echo " ... Done"
9
10 echo " getting into the profile dir ..."
11
12 cd $profile_dir
13
14 pwd
15
16 echo " present size of the database is : "
17
18 du -shc $profile_dir/*.sqlite
19
20 echo " Now running the cleanup...."
21
22 find $profile_dir/ \( -name "*.sqlite" \) -exec sqlite3 {} "vacuum" \;
23
24 echo " Now the size of trimed database is :"
25
26 du -shc $profile_dir/*.sqlite
27
28 echo " Kindly start firefox/swiftfox now .....performance will be much improved"

Now a bit of explanation of the script : what it does basically get into you profile dir i.e where firefox keeps it's profile and run a sqlite3 vaccum command to prune the internal database.

If firefox is running it will kill all instances of it then acting upon it.I have had got significant improvement running this script every second or third day to make my browser up on it's toes.

Hope this will help .

Bhaskar Chowdhury
Google Talk: unixbhaskar Skype: unixbhaskar Y! messenger: unixbhaskar
DiggLinkedinWordpressTwitterTechnoratiStumbleuponReddit

No comments:

Post a Comment