Create encrypted backup archive and move it to Syncthing directory
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Xala 9fdbfbd1f5 add temp log for tar output + possibility to disable compression 1 year ago
LICENSE edit license holders 1 year ago
README.md add logging into syslog + updating doc + script rename 1 year ago
back2sync.sh add temp log for tar output + possibility to disable compression 1 year ago
config add temp log for tar output + possibility to disable compression 1 year ago
install.sh add logging into syslog + updating doc + script rename 1 year ago

README.md

back2sync (b2s)

Bash script to create encrypted backup archive and move it to Syncthing directory

Required packages

  • Mailing: mailx = mailutils or bsd-mailx
  • Archiving: tar
  • Supported compression: gzip, bzip2, xz and zstd
  • Encryption: gpg

For alerting, you need to configure your system to send emails (exim4, postfix, other...).

Install

% git clone https://git.clamifa.net/Xala/back2sync.git
% cd back2sync/
% sudo ./install.sh

Try success install:

% back2sync -h

Configuration

By default, back2sync.sh use ~/.config/back2sync/config file. Edit this file to set your preferences.

Otherwise, create a custom config file and use it with the "-c" option

% back2sync -c /home/toto/my.conf -s /home -d /mnt/syncthing/backups -w /tmp

Usage

Show help:

% back2sync -h

Show backup history:

% back2sync -l

Run backup with default config:

% back2sync -s /home -d /mnt/syncthing/toto-backups -w /tmp

Logging

All success or error messages are logged into syslog with "b2s" tag.

Exemple:

% sudo grep b2s /var/log/syslog | tail -n 10
Apr 16 17:40:12 dx b2s[27080]: Start backup to syncthing
Apr 16 17:40:12 dx b2s[27080]:  - Source: /home
Apr 16 17:40:12 dx b2s[27080]:  - Destination: /mnt/syncthing/toto-backups
Apr 16 17:40:12 dx b2s[27080]:  - Compression: bzip2
Apr 16 17:40:12 dx b2s[27080]:  - Encrypted archive: test-bck.tbz2.gpg
Apr 16 17:40:12 dx b2s[27080]:  - GPG Options: SHA512 / AES256
Apr 16 17:40:39 dx b2s[27080]: Successful compressing test-bck.tbz2
Apr 16 17:40:44 dx b2s[27080]: Successful encrypting test-bck.tbz2
Apr 16 17:40:44 dx b2s[27080]: Successful moving test-bck.tbz2.gpg to /mnt/syncthing/toto-backups
Apr 16 17:40:44 dx b2s[27080]: Successful cleaning working directory

Decrypt memo

% gpg -o arch.tgz --batch --passphrase-file /path/to/secret.file -d /path/to/arch.tgz.gpg

TODO: create decrypt script