Magic-7.3 Command Reference

#

## crash

Handle crash backup files

### Usage:

> crash save | recover [filename]

### Summary:

> The crash command handles crash backup files. The exact operation depends on the options, and are outlined below:
> crash save
>   creates and writes to a single file a copy of the contents of all modified cells. If crash save has been called previously, then the filename specified or generated will be used again. If this is the first call to crash save, or if the previous call was crash save "", then a new, unique filename of a file in the system temporary directory (normally "`/tmp`") is created and remembered for subsequent calls to crash save.
> crash save filename
>   creates and writes to the file filename a copy of the contents of all modified cells. filename is retained as the crash filename, so subsequent uses of crash save without a filename specified will also write to this file.
> crash save ""
>   causes magic to forget the name of the crash file. The next use of crash save without a filename will revert to the behavior of generating a unique filename in the system temporary directory.
> crash recover
>   searches the system temporary directory for magic crash recovery files. If one or more such files is found, then the user is prompted for the action of either recovering or ignoring the most recent file found. If the chosen action is to recover the file, then the contents of the saved crash file are loaded into the database, and the file is removed.
> crash recover filename
>   recovers the database from the contents of the saved crash file filename upon successful read-in, the file filename is removed.

> If a crash file has been generated during a layout editing session, and magic is exited normally with the "quit" command, then the crash backup file is removed.

> For backward-compatibility, crash backup files are always generated when magic receives a SIGTERM signal. In the non-Tcl version of magic, periodic backups are not made.

### Implementation Notes:

> crash is implemented as a built-in command in magic. The Tcl/Tk version defines various scripts in "tools.tcl" that implement a periodic backup using the crash command. Invoking magic on the command-line using "magic -r" is equivalent to starting magic followed by the command "crash recover".

### See Also:

> crashbackups

Return to command index

Last updated: January 12, 2021 at 10:10am