Simple backup system for Linux users who use emacs a lot.
emacs,mktemp,tar,gpg,grep,uniq(all available from standard linux packages),- elisp part of my lisp-goodies project, and
- ~/.emacs.d/start.el (needed for
emacsclientcalled in el-backup).
- Examine el-backup and common.sh (both supposed to run with root privileges).
Create/usr/local/bin/el-backup/and copy el-backup and common.sh there. - Create
/etc/el-backup/and copy secret.conf and public.conf there. Edit global configuration files in/etc/el-backup/. Ensure that onlyrootcan read/etc/el-backup/secret.confand that non-root users are allowed to read/etc/el-backup/public.conf. - For each user enumerated in
/etc/el-backup/secret.conf, copy el-backup.conf to~/.emacs.d/conf/el-backup.confand edit it. - Create group
tmp; the code uses it to mark temporary files. - Copy packaged/backup.el to
~/.emacs.d/local-packages/. (~/.emacs.d/start.el will configure emacs to load backup.el from there.) - Run /usr/local/bin/el-backup/el-backup daily with root privileges.
This will create files
X-Y-Z.tar.bz2andX-Y-Z/user.list.gz(locally on your computer) where X, Y, Z are non-negative integers. Their encrypted copies in remote directory will beX-Y-Z.gpgandX-Y-Z.user.gpg
Only recently modified (later than the previous backup) files will be archived. This means that renamed or moved/downloaded files will not be queued for the next backup unless they have recent modification date. However, such files will be included in the next major archive.
A user can manually mark files in a directory as temporary by placing their name into the file
.temp.files in the same directory. These files will be erased when they become older than two weeks.
By default non-text files are ignored; still binary files can be archived if
- they have "white" extension, or
- their group is "white", or
- their (base) name is "white".
"White", "grey", and "black" lists can be configured in ~/.emacs.d/conf/el-backup.conf.
There is no special command to restore the files; the user is supposed to do it manually. Here is my way to do it:
- Decide if I prefer to use local of remote (encrypted) backup files.
- With
zgreputility, find the file in the list of archived files. Locate the archive with this file. - If needed, decrypt the archive. Extract the file from the
tararchive.
This code is released under GPL 3.0 license.