How to backup Firefox to recover a potentially lost session

3 years ago 420

If you've ever mislaid each of your pinned and unfastened tabs successful Firefox, you cognize however frustrating it tin be. Jack Wallen shows you however helium backs up his league to retrieve tabs from the erstwhile instance.

firefoxhero.jpg

Image: Mozilla

Here's however my Firefox web browser workflow goes.

Each morning, erstwhile I'm acceptable to commencement my archetypal penning session, I log into my desktop PC and motorboat Firefox. When the browser opens, it starts astatine my erstwhile league (with each of my pinned tabs and different tabs I mightiness person had unfastened for research). I constitute and I constitute and I write. That goes connected passim the day. When it comes clip to crook the lights retired successful my office, I adjacent Firefox (because I usage the Nightly merchandise and privation to use the latest additions upon starting the adjacent morning) and accidental goodnight. 

SEE: Checklist: Server inventory (TechRepublic Premium)

The adjacent day, I commencement it each implicit again.

That workflow seldom fails me.

But connected occasion, it does. You see, I person Firefox acceptable to Restore erstwhile league (in Settings), truthful it ever picks up wherever I near off. This is wherever it tin go problematic. Let's say, for example, I hide that I had a 2nd Firefox model unfastened with a azygous tab. If I don't adjacent that secondary model archetypal erstwhile I reopen Firefox the adjacent day, it volition retrieve immoderate authorities it was successful erstwhile it was past closed. If I adjacent that azygous model past ... you spot wherever that's going.

So what bash I do?

One mode to debar specified vexation is to regularly backmost up a circumstantial directory which houses the league state. It's not 100% foolproof, but it has helped maine successful the past. 

I'm going to amusement you however to bash conscionable that. I'll beryllium demonstrating connected Linux, but this tin beryllium done connected macOS and Windows arsenic good (you conscionable person to set the directories and tools used).

What you'll request

The lone happening you'll request is simply a moving lawsuit of Firefox. That's it. Let's get to work.

How to find your Firefox illustration directory

The archetypal happening we indispensable bash is find our Firefox illustration directory. To bash this, unfastened Firefox and benignant about:support successful the code bar. In the resulting model (Figure A), look for the enactment Profile Directory.

Figure A

firefoxrecovera.jpg

This leafage gives you much accusation astir Firefox than you astir apt ever needed.

Your Profile Directory volition beryllium successful /home/USER/.mozilla/firefox/STRING.default

Where USER is your Linux username and STRING is simply a random drawstring of characters.

Copy that afloat path.

How to make the backup successful Firefox

What we're going to bash is usage cron to make a regular backup that volition hap earlier Firefox is closed astatine the extremity of the day. Say, for instance, you adjacent Firefox astatine 10 p.m. We'll tally the backup astatine 9 p.m. (that mode we cognize we're redeeming each of our unfastened tabs).

We're going to make a publication that volition tally the backup and past make a cron occupation that volition tally the publication each nighttime astatine 9 p.m.

Create the publication with the command:

nano firefoxbackup.sh

In that publication adhd the following:

#!/bin/bash BDIR="/home/USER/.mozilla/firefox/STRING.default/sessionstore-backups" BLOC="/home/USER/Documents" tar -czvf $BLOC/firefoxbackup.tar.gz $BDIR

Where USER Is your Linux username and STRING is the random drawstring of characters for your Firefox illustration directory.

Save and adjacent the file.

Give the record executable permissions with:

chmod u+x firefoxbackup.sh

Test the record to marque definite it works with:

./firefoxbackup.sh

After it completes, you should spot the record firefoxbackup.tar.gz successful your ~/Documents directory. 

How to make the cron occupation successful Firefox

Now we're going to make the cron job. Open the crontab exertion with:

crontab -e

At the bottommost of that file, we'll add:

0 21 * * * /home/USER/firefoxbackup.sh >/dev/null 2>&1

You tin alteration the determination of the backupscript to beryllium wherever you prefer. Just marque sure, if you alteration the determination of the script, that alteration is reflected successful the cronjob.

Now, astatine 9 p.m. each night, your sessionstore-backups directory (the directory that really houses the accusation for your sessions) volition beryllium backed up to ~/Documents. Should thing spell incorrect that day, you tin reconstruct Firefox to the erstwhile night's league and reclaim each of those unfastened tabs.

No, this won't reconstruct the tabs you person unfastened astatine the infinitesimal the occupation occurs, but it volition prevention you from having to reopen and re-pin each of those tabs. This small instrumentality has saved maine a bully magnitude of clip connected a fewer occasions. Set it up and anticipation you ne'er person to beryllium connected the backup.

Open Source Weekly Newsletter

You don't privation to miss our tips, tutorials, and commentary connected the Linux OS and unfastened root applications. Delivered Tuesdays

Sign up today

Also see

Read Entire Article