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 has to change the path of thir own profile, nothing else has to be done.I gave it a name: can give anything you want :)

1 #!/bin/bash
2 profile_dir="/home/bhaskar/.mozilla/firefox/2zbbd86m.default"
4 echo " Killing all running swiftfox instances for database clean up..."
6 pkill swiftfox-bin
8 echo " ... Done"
10 echo " getting into the profile dir ..."
12 cd $profile_dir
14 pwd
16 echo " present size of the database is : "
18 du -shc $profile_dir/*.sqlite
20 echo " Now running the cleanup...."
22 find $profile_dir/ \( -name "*.sqlite" \) -exec sqlite3 {} "vacuum" \;
24 echo " Now the size of trimed database is :"
26 du -shc $profile_dir/*.sqlite
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

No comments:

Post a Comment