About File Insurance -------------------- These scripts were written in response to a serious bug in a piece of software I once used extensively. The program would occasionally crash while saving. The crashes would irrecoverably corrupt the files being saved, resulting in total data loss. Bug reports to the developer weren't addressed. At that time, I didn't have a continuous backup system, so after losing important data one time too many, I whipped up these scripts. file-insurance monitors a PID and one or more files. Every 5 minutes until the PID terminates, it makes a copy of the files it is monitoring and timestamps them. If the copy is identical to the most recent one, it is discarded. Call it with --help for usage instructions. file-insurance-cleanup is intended to be run manually once it is known that all is well with the data. It deletes the backups created by file-insurance except the most recent one. Call it with --help for usage instructions. start-program-with-file-insurance launches the program specified on the command line, passing it all filename arguments given. Then, it starts file-insurance and arranges for it to monitor those files. Known Bug --------- The file-insurance scripts frequently parse the output of ls. However, ls was designed for human readability and not for parsing. It is impossible to write code to parse the output of ls that works for all valid filenames. For practical purposes, though, these scripts' use of ls is OK; it isn't common to encounter filenames containing newlines or other "unusual" characters. These scripts can cope with spaces in filenames. Other "weird" characters might cause these scripts to blow up. This bug isn't deemed worth fixing at this time. Filenames that would break the scripts are uncommon. The proper fix would be to replace ls with shell globs. Even then, that wouldn't solve all issues. A complete solution would most likely involve a rewrite in another language, and such a rewrite simply isn't worth the time it would take.