In Norse mythology, Snotra (Old Norse "clever") is a goddess associated with wisdom.
Snotra-backup is a backup script that uses duplicity and mysqldump to back up and encrypt files, folders and databases. It supports multiple backends, and it can synchronize the backups with Google Cloud Storage and/or Amazon AWS (untested). In addition you can write your own command that is executed when all backup definitions are done, that way you can move, copy or upload the files wherever. It is up to you.
- Python
- duplicity
- mysqldump (if backing up databases)
- NcFTP (if backend 'ftp')
- gsutil (if sync with Google Cloud Storage)
- s3cmd (if sync with Amazon AWS)
- configparser
- file
- ftp
- rsync
Create symbolic link for shared library files:
$ sudo ln -s /path/to/snotra/share/ /usr/local/share/snotraCreate symbolic link in /usr/local/sbin folder, this is not required but will make Snotra system-wide available for the root user:
$ sudo ln -s /path/to/snotra/snotra.py /usr/local/sbin/snotra.py| Argument | Action |
|---|---|
-s, --show |
Show all commands, but do nothing. |
-n, --dry-run |
Show that would have been done, but do nothing. |
-c, --config <file> |
Run with the spesified config file. |
-v |
Print version. |
The config file is read from /etc/snotra/snotra.conf. A sample config is provided, make your changes and copy it to /etc/snotra/snotra.conf.
See comments in snotra.conf.sample for parameters.
Create file /etc/cron.d/snotra with the content below, this make will make Snotra run every night at 3:30:
MAILTO=root
# Run daily backup
30 3 * * * root [ -x /usr/local/sbin/snotra.py ] && /usr/local/sbin/snotra.py > /dev/nullSnotra-backup logs to /var/log/snotra.log by default, but this can be changed in the config file.
Since the log file can get pretty big over time it's wise to rotate it every now and then.
Create file /etc/logrotate.d/snotra with the content below, this will make logrotate pick up the logfile:
/var/log/snotra.log {
weekly
rotate 4
missingok
compress
delaycompress
notifempty
create 640 root adm
}
duplicity verify rsync://user@your.domain:1234//backup/etc /etc
duplicity list-current-files rsync://user@your.domain:1234//backup/etc /etc
# Get latest
duplicity --file-to-restore apt/sources.list rsync://user@your.domain:1234//backup/etc /home/user/sources.list
# Get file from 4 days ago
duplicity -t 3D --file-to-restore apt/sources.list rsync://user@your.domain:1234//backup/etc /home/user/sources.list
The application is still work in progress so there may be bugs. Please report all bugs to the issue tracker on this repository.
Thomas Jensen