#!/bin/bash
# Criado em:Dom 15/Ago/2010 hs 11:38
# Last Change: Seg 16/Ago/2010 hs 06:44
# vim:ft=sh:fdm=syntax:nu:
# Instituicao: none
# Proposito do script: otimizar a base de dados do firefox
# Autor: Sérgio Luiz Araújo Silva
# site: http://vivaotux.blogspot.com
# fonte: http://andrenoel.com.br/2009/07/27/melhorando-a-performance-do-firefox-aspirando-o-sqlite/
function optimaze-firefox () {
#optimizing Firefox sqlite databases
[ -z "`whereis sqlite | awk \'{print $2}\'`" ] && echo instale o sqlite
firefox="`find ~/.mozilla/ -iname "*.default"`"
opt_lock="$firefox/optimize-sqlite"
today=$(date +%F)
if [ -n "`pidof firefox-bin`" ]; then
clear
echo "para limpar o cache do firefox feche o mesmo"
echo "e rode este script novamete"
exit 1
fi
cd $firefox
if [ -e $opt_lock ]
then
last_run=$(ls -l $opt_lock | awk \'{print $6}\')
else
last_run=\'1900-01-01\'
fi
if [ $last_run != $today ]
then
cd $firefox
echo -n "Optimizing Firefox… "
for i in *.sqlite
do
sqlite3 $i vacuum
echo -n \'+\'
done
echo
touch $opt_lock
echo "Done."
fi
cd ~/
}
optimaze-firefox