5

I just had my first Firefox crash where I lost all the tabs in my session (thanks to Firefox Panorama, that number was quite high too). Luckily, Firefox kept backups from the sessionstore.js file, and the most recent was just 2 days old.

However it seems that the backups of those sessionstore.js files is done quite rarely and I would like Firefox to backup it more often (like every second or every day, as it does with the bookmarks). Is there any way to do that?

5
  1. Go to about:config
  2. Type browser.sessionstore.interval in the Filter
  3. Change the value from its default of 10000 to something smaller
  4. Restart Firefox (may not need to, doesn't hurt if you do)

But if you want to create copies of the file instead marked by the timestamp, you can run a Scheduled Task and execute some batch file (if you're using Windows) like the following:

@echo off

set sessionFilePrefix=c:\path-to-session-location\sessionstore
set sessionFileSuffix=.js

set stampH=%time:~0,2%
if %stampH% lss 10 (set stampH=0%time:~1,1%)
set stampM=%time:~3,2%
set stampS=%time:~6,2%
set stampU=%time:~9,2%
set sessionVer=%stampH%%stampM%%stampS%%stampU%

:Start
IF NOT EXIST "%sessionFilePrefix%%sessionFileSuffix%" (GOTO :End)
IF NOT EXIST "%sessionFilePrefix%-%sessionVer%%sessionFileSuffix%" (
copy "%sessionFilePrefix%%sessionFileSuffix%" "%sessionFilePrefix%-%sessionVer%%sessionFileSuffix%"
):End

Now, whenever the scheduled task runs that batch file operation you'll create backup copies of the sessionstore.js file. You'll end up with files that look like this:

  • sessionstore-10302087.js
  • sessionstore-10334925.js, etc.

Remember to purge these files every now and then.

  • I read that that option only changes how often Firefox writes to the sessionstore.js file while a session is running. But I want Firefox to create backups more often (i.e. sessionstore-1.js, sessionstore-2.js, sessionstore-3.js, ...) – poke Oct 25 '10 at 12:56
  • If you want to create backups, you may want to try running a scheduled task to spawn them @pok – random Oct 25 '10 at 14:38
  • Thanks for the script, I just thought that Firefox had some setting for that (as Firefox already does backup them; just to rarely for me). – poke Oct 25 '10 at 16:30
  • Note that in recent versions of Firefox (as of Feb 2018), the sessionstore file is created only after you exit from Firefox. The browser.sessionstore.interval preference instead controls how often Fx writes to the sessionstore-backups/recovery.jsonlz4 file. Well, it's supposed to, but that's still buggy and doesn't reliably happen, so an addon like Session Manager would help by making these auto-backups (in Fx 56 and lower only for now). – sundar Feb 16 '18 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.