Sync Firefox from the Command Line
There are lots of solutions for syncing Firefox, and I must confess I haven't used any of them. As I've read the descriptions, I've always gotten the sense that they wouldn't do what I wanted, the way I wanted it, when I wanted it. Necessity being the mother of invention, I wrote my own shell script to do what I needed.
I have Firefox running on four Linux systems and one Windows system, and all of them have the same extensions installed. My sync is a simple rsync of the Firefox settings directory from another system. This copies bookmarks and passwords, and I have used it for quite some time without any ill effects:
#!/bin/bash user_name=mitch if [[ ! "$1" ]]; then echo "Usage: $0 FROM-HOST" exit 1 fi # Check for cygwin. if [[ -d /cygdrive/c ]]; then rpath=/home/$user_name/.mozilla/firefox/default.enr lpath="$(find /cygdrive/c/Documents\ and\ Settings/$user_name/Application\ Data/Mozilla/Firefox/Profiles/ -iname '*.default')" else rpath=~/.mozilla lpath=~/.mozilla fi rsync -av --delete --exclude=Cache --exclude=lock "$1":"$rpath/" "$lpath"
$ syncff my-other-system
Obviously, you will need to modify the script to make sure that the paths it uses are valid for your installation.
One shortcoming is that this script will not work with a Cygwin system as the other system. That should be possible, but the script will need modifications and testing to accomplish it. When syncing Linux systems, I sync the entire .mozilla directory, which should probably work even if you use Seamonkey or have the Eclipse browser component installed, but test it to be sure, and shut them down before syncing also.
You may notice the rsync command excludes not only the Cache directory but a file named lock. If you don't exclude the lock file, Firefox will think that another instance is already running when it starts up.
Mitch Frazier is an Associate Editor for Linux Journal.
Webinar: 8 Signs You’re Beyond Cron
On Demand NOW
|Non-Linux FOSS: All the Bitcoin, None of the Bloat||May 26, 2015|
|Dr Hjkl on the Command Line||May 21, 2015|
|Initializing and Managing Services in Linux: Past, Present and Future||May 20, 2015|
|Goodbye, Pi. Hello, C.H.I.P.||May 18, 2015|
|Using Hiera with Puppet||May 14, 2015|
|Urgent Kernel Patch for Ubuntu||May 12, 2015|
- Initializing and Managing Services in Linux: Past, Present and Future
- Non-Linux FOSS: All the Bitcoin, None of the Bloat
- Dr Hjkl on the Command Line
- Using Hiera with Puppet
- Goodbye, Pi. Hello, C.H.I.P.
- Gartner Dubs DivvyCloud Cool Cloud Management Vendor
- Mumblehard--Let's End Its Five-Year Reign
- It's Easier to Ask Forgiveness...
- Infinite BusyBox with systemd
- Urgent Kernel Patch for Ubuntu