From 0927ef7b20ea1e0c1ce5d397a90677ce978c119d Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Sun, 4 Nov 2012 11:43:10 -0800 Subject: [PATCH] Script to vacuum sqlite files to help make firefox faster --- bin/fasterfirefox | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 bin/fasterfirefox diff --git a/bin/fasterfirefox b/bin/fasterfirefox new file mode 100755 index 0000000..8162914 --- /dev/null +++ b/bin/fasterfirefox @@ -0,0 +1,34 @@ +#!/bin/bash + +username=$(whoami) +proc="$(ps aux | grep $username | grep -v $0 | grep firefox | grep -v grep)" +if [ "$proc" != "" ] +then + echo "shutdown firefox first!" + exit 1 +fi + +curdir=$(pwd) + +for dir in $(cat ~/.mozilla/firefox/profiles.ini | grep Path= | sed -e 's/Path=//') +do + cd ~/.mozilla/firefox/$dir 2>/dev/null + if [ $? == 0 ] + then + echo "In $(pwd)" + echo -e " running...\n" + + for F in $(find . -type f -name '*.sqlite' -print) + do + sqlite3 $F "VACUUM;" + done + + echo -e "done in $(pwd) ...\n" + else + echo -e "\n !!!! Error while entering directory $dir !!!!\n" + fi +done +echo "Job finished"; + +cd $curdir +