56 lines
2.8 KiB
Bash
56 lines
2.8 KiB
Bash
#!/bin/bash
|
|
# --------------------------------------------------------
|
|
# Please double check Your settings
|
|
# --------------------------------------------------------
|
|
|
|
enabled=false # enable the script
|
|
backup_path='/opt/backify' # where to save backups; must NOT end with trailing slash
|
|
|
|
www_backup=false # backup wwwroot
|
|
www_dir='xyz' # location of wwwroot to backup
|
|
|
|
vhost_backup=false # backup vhost configurations
|
|
vhost_dir='/etc/httpd/sites-enabled' # location of active vhost files
|
|
|
|
log_backup=false # backup logs
|
|
log_to_backup=("apache" "nginx" "fail2ban" "pckg_mngr" "auth" "dmesg" "dpkg" "letsencrypt" "php" "syslog" "purge")
|
|
# logs to backup, options: apache, nginx, fail2ban, pckg_mngr, auth, dmesg, dpkg, letsencrypt, php, syslog, purge (truncate all)
|
|
|
|
rsync_push=false # enable push to remote server
|
|
push_clean=false # delete local archive after successful push
|
|
target_host="127.0.0.1" # rsync target host (single-target mode)
|
|
target_user="backup" # rsync target user (single-target mode)
|
|
target_key='/home/xyz/.ssh/rsync' # rsync SSH key
|
|
target_dir='/opt/backups/srvyxyz/' # rsync target host path
|
|
|
|
# Optional: multiple rsync targets. If set, these are used instead of target_host/target_user/target_dir.
|
|
# Each entry is a full rsync destination: user@host:/path
|
|
# Example:
|
|
# targets=("backup@host1:/backups/server1/" "backup@host2:/backups/server2/")
|
|
targets=()
|
|
|
|
docker_enabled=false # enable Docker backup
|
|
docker_images=false # backup Docker images
|
|
docker_volumes=false # backup Docker volumes
|
|
docker_data=false # backup container information
|
|
tar_opts='' # optional TAR_OPTS passed to docker volume backup container (e.g. "-J" for xz compression)
|
|
|
|
db_backup=false # backup databases
|
|
database_type=mysql # mysql or postgresql
|
|
db_host='localhost' # database host
|
|
db_port=3306 # port for DB access
|
|
db_username='user' # database user
|
|
db_password='user' # database password
|
|
db_all=false # dump all databases if true
|
|
db_name='user' # name of the database if db_all=false
|
|
|
|
custom_backup=false # backup custom files or directories
|
|
custom_dirs=("/opt/example" "/var/log/script.log") # array of custom files/directories to backup
|
|
|
|
# Optional: retention policy for local archives. 0 disables the check.
|
|
retention_days=0 # delete archives older than this many days (0 = disabled)
|
|
retention_keep_min=0 # always keep at least this many newest archives (0 = disabled)
|
|
|
|
# Optional: hooks (executed only in non-dry-run mode)
|
|
pre_backup_hook='' # executable run before backup; receives TMPDIR as $1
|
|
post_backup_hook='' # executable run after success; receives archive path as $1 |