##
Backup and Perpetual Session

Default behavior:
In an effort to minimize loss of work due to user, hardware, or software issues, CINELERRA-GG has some automatic backup capabilities. CINELERRA-GG automatically saves every editing operation to the current project on disk continuously to a file named $HOME/.bcast5/backup.xml. We can also make a manual backup via File → Save backup ("b") or we can load the chosen backup via File → Load backup. Before a new backup is rewritten to backup.xml by an editing operation, the content is automatically copied to backup.prev which becomes a second backup file. In total we have 2 levels of backups: the previous one, called backup.prev, and the current one, called backup.xml.

In the un-likely event of a crash, when you restart CINELERRA-GG, you should select File → Load backup in order to continue with the operations that were recorded before the crash. If you have more than 1 instance of CINELERRA-GG running, only the last editing operation made in whichever instance it was last made, will overwrite the backup.xml. If for some reason you forgot to use Load backup immediately when restarting or you did a Load with Replace current project in your current session (not default behavior!), you have a second chance to use File → Load backup and select $HOME/.bcast5/backup.prev as long as you only loaded a different file and have performed no editing operations. This same file is also used by multiple instances of CINELERRA-GG.

Use of Autosaves continuous backups: 1
Autosaves continuous backups can be enabled in (see Dangerous section):
Settings → Preferences → Appearance Tab → Dangerous
In this modality the formation of backup.xml and backup.prev remains the same. In addition there is a simultaneous formation of a third copy with a timestamp, called backup_prev.xxxxxxxx.xxxx (with Date and Clock time). So at each editing operation a backup will be created with its own timestamp. The user can thus go back to the moment when he wants to restart an editing, because of an error, or to experiment with different choices from a certain moment on.

We can load the backup file of our choice via File → Load backup. For long editing sessions it is easy to have lots of backups but when you exit from CINELERRA-GG, all files with timestamps will be deleted except the last 50, which will still be available at the next restart.

Perpetual session:
is very useful for working on a project over many days so you can just quit before shutting down and the next time you start up CINELERRA-GG you will be right back where you left off. You will retain all of your undo’s and redo’s. The binary file name is $HOME/.bcast5/perpetual.dat and as long as Settings → Preferences, the Appearance tab has the Flag Perpetual session set this capability takes effect. It is very important to understand that this is not the same as the continuously editing- operation-updated backup.xml file which is still operating as usual. The perpetual.dat file is updated so that when you Quit CINELERRA-GG in the normal manner, interrupt the program, kill the program, or there is a segv or system crash, the perpetual.dat file still reflects the state of your project. This means the editing/undo’s/redo’s you executed during the current session should still be available on a restart with the exception of any edit that may not have had a chance to be written on disk before an abnormal stoppage.

Some notes to keep in mind about Perpetual session are:

- when you Quit in the normal manner, it does not have to ask whether or not to save a backup
- takes disk space in .bcast5 area and this could get really big
- after you complete a project, it is advisable to turn off the Perpetual session flag before quitting so that when you start a new project, you can start with a fresh perpetual.dat by turning the flag on or after stopping CINELERRA-GG, delete the current $HOME/.bcast5/perpetual.dat file
- only session data is backed up (not program feature setup)
- the files backup.xml and backup.prev will operate the same as before so that if there is a crash, you can still use File → Load backup in order to continue where you were interrupted.
- to start CINELERRA-GG without using your Perpetual session data even if enabled, keyin: /your_cinelerra_path/bin/cin -S

For developers:
We report the list of editing events that lead to the automatic formation of a backup file:

- cinelerra/cwindowgui.C
- cinelerra/swindow.C
- cinelerra/keyframepopup.C
- cinelerra/pluginpopup.C
- cinelerra/mwindowedit.C
- cinelerra/presetsgui.C.sav1
- cinelerra/assetpopup.C
- cinelerra/cwindowtool.C
- cinelerra/render.C
- cinelerra/setformat.C
- cinelerra/mwindow.C
- cinelerra/keyframegui.C
- cinelerra/mwindowgui.C
- cinelerra/mainmenu.C
- cinelerra/loadfile.C
- cinelerra/savefile.C
- cinelerra/menueffects.C
- cinelerra/main.C
- cinelerra/presetsgui.C.sav
- cinelerra/record.C
- cinelerra/plugindialog.C

#### Footnotes

... backups: 1
  credits to Andrew Randrianasulu and Reuss Andràs