How to implement auto-save?

Hello,

I live in place where electricity goes down on regular basis. Considering that and DO stands alive during most of the time (i.e. Lister is not closing so it saves), add maybe some other unexpected crash here & there, I started to think about implementing an Auto-saving feature.

I checked out and I think to use OnOpenTab, OnCloseTab, OnCloseLister and call Prefs LAYOUTSAVE=updatecurrent (I'm not sure about adding single). This will ignore any toolbar changes but I don't see such events. It is not so frequent thing to update anyway...

So, do you think this is nice approach?

Thank you.

A matter of personal preference, I guess. I am more concerned about modified toolbars than open tabs. So I back up my config regularly, but never any open tabs, lister positions etc.

I'd quickly get an uninterruptible power supply for my system, but that's a topic for a different forum.

As far I saw, my modified toolbars were kept. Just my tabs were gone, and I kind of hate to go recreate these at such cases. I also consider at some point for a backup PSU for say 5 minutes (smaller, cheaper).

I would save on OnAfterFolderChange as well, and probably save a special "backup" layout of all listers.

I feel like someone's already done this, but I can't find the script or thread, so maybe I am wrong.

A UPS is definitely the way to go, though. You don't want your PC suddenly losing power, as that's a good way to corrupt data and wind up with strange, random issues that you can never be sure weren't caused by the power going out in the middle of a file being written.

I have similar power problems here and several UPS as a result. They won't always last long enough to keep the PC up through a cut, but they avoid interruptions through short cuts and, for longer ones, will tell the PC to shut down gracefully and give it time to do so.

1 Like

I think you are right about OnAfterFolderChange the tab events won't help at all. If save is done on opening, it will save most likely an unuseful folder. If save is done on closing, it will save the closed tab, which is also not okay. So, what is left only is during the close of the lister and as you said when a folder is changed. However, I'm reluctant to write to a disk each time when I switch folders :slight_smile: Maybe, it might be some sort of timer, say each X minutes.