Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted
  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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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