Firefox increase sessionstore.js backup frequency

backupfirefox

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?

Best Answer

  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.

Related Question