Backup and download scripts to compress with 7z data for a debian server and download it to another machine.
|
|
7 лет назад | |
|---|---|---|
| scripts | 7 лет назад | |
| LICENSE | 8 лет назад | |
| README.md | 7 лет назад | |
| backup-server | 7 лет назад | |
| download-backup-http | 7 лет назад | |
| download-backup-sftp | 7 лет назад |
Backup and download scripts to compress with:
The backup script (backup-server) compress with 7z server info like:
Also it's:
# curl "https://code.castanedo.es/guzman/backup-server/archive/2.0.tar.gz" | tar -xz
# cp ./backup-server/backup-server /usr/local/bin/backup-server
# cp ./backup-server/scripts/cron.d/backup-server /etc/cron.d/backup-server
# cp ./backup-server/scripts/logrotate.d/backup-server /etc/logrotate.d/backup-server
# rm -R ./backup-server
Edit /etc/cron.d/backup-server to automatic backups as desired.
# backup-server [options]... -z|-j|-J|-7 [backupdir]
backupdir: argument to set to directory to save the backup
-p, --prefix name: prefix for the name of the backup
--no-postfix: disable the postfi: the full name will be the prefix
--no-remove: no remove old files
--remove-days number: set number of days to considere a backup old
-u, --user uid: name of the user owner of the backup
-g, --group gid: name of the group owner of the backup
--permision-mask number: octal mask to set accesss permision of the backup
-z, --gzip: compress using gzip (tar.gz or tar.gz.gpg)-j, --bzip2: compress using bzip2 (tar.bz2 or tar.bz2.gpg)-J, --xz: compress using xz (tar.xz or tar.xz.gpg)-7, --7zip: compress using 7z (7z)-k, --key-id ID: set gpg2 public key-id used for encryption
--no-encryption: disable the encryption of the backup
--7z-password password: set password (ONLY for 7z)
--web-dir dir: set web pages directory to backup
--no-web: disable backup of web pages
--no-sql: disable MySQL/MariaDB backup
--sql-user username: set MySQL/MariaDB username
--sql-password password: set MySQL/MariaDB password
--nginx-dir dir: set nginx configuration directory to backup
--no-nginx: disable Nginx backup
--letsencrypt-dir dir: set Let's Encrypt configuration directory to backup
--no-letsencrypt: disable Let's Encrypt backup
--mail-dir dir: set Mailboxes directory to backup
--no-mail: disable mailboxes backup
--home-dir dir: set home directories to backup
--no-home: disable home directory backup
--gogs-dir dir: set GOGS Git Repository to backup
--no-gogs: disable gogs backup
-h, --help: shows this message and exitbackup-server --xz -k ABCDEFG -p backup-example.com --no-sql /var/backup
/var/backup compressed with XZ and encrypted with GPG2 Public Key (backup-example.com-2018-03-19-a1b2c3.tar.xz.gpg)backup-server -7 --7z-password 7zpass --sql-user root --sql-password toor /var/www/backup
/var/www/backup compressed with 7Zip and encrypted (backup-castanedo.es-2018-03-19-abcedf.7z)backup-server -z --no-encryption --no-sql /var/backup
/var/backup compressed with Gzip and no encrypted (/var/backup/backup-castanedo.es-2018-03-19-qwerty.tar.gz)It's possible to make backups automatic creating a cron.d task (/etc/cron.d/backup-server).
There are an example in scripts folder.
The download script (download-backup-http) download all the compressed files in a remote machine, via http/https Auth Basic Aunthentication.
The download script (download-backup-sftp) download all the compressed files in a remote machine, via sftp (SSH File Transfer Protocol).