obackup/host_backup.conf

169 lines
7.5 KiB
Plaintext
Raw Normal View History

2013-06-14 22:27:11 +02:00
#!/bin/bash
###### Remote (or local) backup script for files & databases
2013-11-02 18:55:17 +01:00
###### (L) 2013 by Ozy de Jong (www.netpower.fr)
###### Config file rev 2411201401
2013-06-14 22:27:11 +02:00
2013-11-02 18:55:17 +01:00
## ---------- GENERAL BACKUP OPTIONS
## Backup identification name.
2013-06-16 13:54:20 +02:00
BACKUP_ID="your backup name"
2013-06-14 22:27:11 +02:00
2013-11-02 18:55:17 +01:00
## Log file location. Leaving this empty will create log file at /var/log/obackup_version_BACKUP_ID.log (or current directory if /var/log doesn't exist)
2013-08-18 11:58:55 +02:00
LOGFILE=""
2013-11-02 18:55:17 +01:00
## Backup databases
2013-06-16 13:54:20 +02:00
BACKUP_SQL=no
2013-11-02 18:55:17 +01:00
## Backup files
2013-06-21 18:15:40 +02:00
BACKUP_FILES=yes
2013-06-14 22:27:11 +02:00
2013-11-02 18:55:17 +01:00
## ---------- LOCAL BACKUP STORAGE OPTIONS
## Local storage paths where to put backups
2013-06-14 22:27:11 +02:00
LOCAL_SQL_STORAGE="/home/storage/backup/sql"
LOCAL_FILE_STORAGE="/home/storage/backup/files"
2013-11-02 18:55:17 +01:00
## Create backup directories if they do not exist
CREATE_DIRS=yes
## Keep absolute source path in your backup, eg: /your/backup/storage/the/remote/server/files
## You should leave this enabled if you intend to use 'backup task division' functionality of OBackup, or everything will end up in the same directory.
2013-06-14 22:27:11 +02:00
LOCAL_STORAGE_KEEP_ABSOLUTE_PATHS=yes
2013-11-02 18:55:17 +01:00
## Generate an alert if backup size is lower than given value in Kb (this can also help identifying empty mount dirs)
2013-06-14 22:27:11 +02:00
BACKUP_SIZE_MINIMUM=1024
2013-11-02 18:55:17 +01:00
2013-06-14 22:27:11 +02:00
## Generate an alert if local storage free space is lower than given value in Kb.
LOCAL_STORAGE_WARN_MIN_SPACE=1048576
2013-11-02 18:55:17 +01:00
## ---------- MISC OPTIONS
## Bandwidth limit Kbytes / second for file backups. Leave 0 to disable limitation.
2013-08-18 11:58:55 +02:00
BANDWIDTH=0
2013-11-02 18:55:17 +01:00
## If enabled, file backups will be processed as superuser. See documentation for /etc/sudoers configuration ("find", "du" and "rsync" need to be allowed). Requiretty needs to be disabled.
2013-08-04 16:16:27 +02:00
SUDO_EXEC=no
2013-11-02 18:55:17 +01:00
## Paranoia option. Don't change this unless you read the documentation.
2013-06-21 18:15:40 +02:00
RSYNC_EXECUTABLE=rsync
2013-06-14 22:27:11 +02:00
2013-11-02 18:55:17 +01:00
## ---------- REMOTE BACKUP OPTIONS
## The following options allow this Obackup instance to connect to a remote system via an ssh tunnel.
## Needs public RSA key need to be put into ~/.ssh/authorized_keys in remote users home directory.
REMOTE_BACKUP=no
2013-06-14 22:27:11 +02:00
SSH_RSA_PRIVATE_KEY=~/.ssh/id_rsa
REMOTE_USER=backupuser
REMOTE_HOST=yourhost.local
REMOTE_PORT=22
## ssh compression should be used unless your remote connection is good enough (LAN)
SSH_COMPRESSION=yes
2013-11-02 18:55:17 +01:00
## Remote rsync executable path. Leave this empty in most cases
2014-03-23 17:46:08 +01:00
RSYNC_REMOTE_PATH=""
2013-11-02 18:55:17 +01:00
2013-06-14 22:27:11 +02:00
## Check for connectivity to remote host before launching remote backup tasks. Be sure the hosts responds to ping. Failing to ping will skip current task.
REMOTE_HOST_PING=yes
## Check for internet access by pinging one or more 3rd party hosts before remote backup tasks. Leave empty if you don't want this check to be be performed. Failing to ping will skip current task.
2013-08-24 19:41:18 +02:00
REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com"
2013-06-14 22:27:11 +02:00
2013-11-02 18:55:17 +01:00
## ---------- DATABASE BACKUP OPTIONS
## Database backup user
2013-06-14 22:27:11 +02:00
SQL_USER=backupuser
2013-11-02 18:55:17 +01:00
## Enabling the following option will save all databases on local or remote given SQL instance except the ones specified in the exlude list.
## Every found database will be backed up as separate backup task.
2013-06-14 22:27:11 +02:00
DATABASES_ALL=yes
2013-07-18 13:31:17 +02:00
DATABASES_ALL_EXCLUDE_LIST="test;mysql"
2013-11-02 18:55:17 +01:00
## Alternatively, if DATABASES_ALL=no, you can specifiy a list of databases to backup separated by spaces.
2013-06-14 22:27:11 +02:00
DATABASES_LIST=""
2013-11-02 18:55:17 +01:00
## Max backup execution time per Database task. Soft max exec time generates a warning only. Hard max ecec time generates a warning and stops current backup task.
## If a task gets stopped, next one in the task list gets executed. Time is specified in seconds.
2013-06-14 22:27:11 +02:00
SOFT_MAX_EXEC_TIME_DB_TASK=3600
HARD_MAX_EXEC_TIME_DB_TASK=7200
2013-11-02 18:55:17 +01:00
## Preferred SQL dump compression. Compression methods can be xz, lzma, pigz or gzip (will fallback from xz to gzip depending if available)
## Generally, level 5 is a good compromise between cpu, memory hunger and compress ratio. Gzipped files are set to be rsyncable.
2013-06-14 22:27:11 +02:00
COMPRESSION_LEVEL=3
2013-11-02 18:55:17 +01:00
## SQL Dump compression should be done on remote side but can also be done locally to lower remote system usage (will take more bandwidth, check for ssh compression)
2013-06-14 22:27:11 +02:00
COMPRESSION_REMOTE=yes
2013-11-02 18:55:17 +01:00
## ---------- FILES BACKUP OPTIONS
## Directories backup list. List of semicolon separated directories that will be backed up recursively. Every directory will be processed as one backup task.
DIRECTORIES_SIMPLE_LIST="/var/named;/var/lib"
## There's a special backup schema in Obackup called 'backup task division' which creates one backup task per level 1 subdirectory of a directory.
## This is VERY usefull to backup multiple virtualhosts as separate tasks without having to specifiy each one separately.
## This may also be usefull dividing big data directories in subdirectories tasks.
## Directories backup task division backup: Semicolon separated directories of which every level 1 subdirectory will be backed up recursively as a spearate backup task.
## Example: "/home;/var" will create tasks "/home/dir1", "/home/dir2", ... "/home/dirN", "/var/log", "/var/lib"... "/var/whatever"
2013-06-14 22:27:11 +02:00
DIRECTORIES_RECURSE_LIST="/home"
2013-11-02 18:55:17 +01:00
## You may optionally exclude subdirectories from task division. On the above example you could exclude /home/dir2 by adding it to DIRECTORIES_RECURSE_EXCLUDE_LIST
2013-06-14 22:27:11 +02:00
DIRECTORIES_RECURSE_EXCLUDE_LIST="/home/backupuser;/home/lost+found"
2013-11-02 18:55:17 +01:00
## Rsync exclude patterns, used by simple and division lists
2013-06-14 22:27:11 +02:00
RSYNC_EXCLUDE_PATTERN="*/tmp;*/ftp/www/cache/cachefs;*/sessions"
2013-11-02 18:55:17 +01:00
## File that contains the list of directories or files to exclude from sync on both sides. Leave this empty if you don't want to use an exclusion file.
## This file has to be in the same directory as the config file
## Paths are relative to sync dirs. One element per line.
RSYNC_EXCLUDE_FROM=""
#RSYNC_EXCLUDE_FROM="exclude.list"
2013-11-02 18:55:17 +01:00
## List separator char. You may set an alternative seperator char for your directories lists above.
PATH_SEPARATOR_CHAR=";"
## Preserve ACLS. Make sure source and target FS can hold same ACLs or you'll get loads of errors.
2013-08-04 16:16:27 +02:00
PRESERVE_ACL=no
2013-11-02 18:55:17 +01:00
## Preserve Xattr. MAke sure source and target FS can hold same Xattr or you'll get loads of errors.
2013-08-04 16:16:27 +02:00
PRESERVE_XATTR=no
2013-11-02 18:55:17 +01:00
## Let RSYNC compress file transfers. Do not use this on local-local backup schemes. Also, this is not usefull if SSH compression is enabled.
RSYNC_COMPRESS=no
2013-06-14 22:27:11 +02:00
## Max execution time per file backup task. Soft is warning only. Hard is warning, stopping backup and processing next one one file list. Tilme is specified in seconds
SOFT_MAX_EXEC_TIME_FILE_TASK=3600
HARD_MAX_EXEC_TIME_FILE_TASK=7200
2013-11-02 18:55:17 +01:00
## ---------- ALERT OPTIONS
2013-06-14 22:27:11 +02:00
## Alert email adresses separated by a space character
DESTINATION_MAILS="your@mail.address"
2013-06-14 22:27:11 +02:00
2013-11-02 18:55:17 +01:00
## Windows (MSYS environment) only mail options (used by sendemail.exe)
2013-09-22 12:04:09 +02:00
SENDER_MAIL="alert@your.system"
SMTP_SERVER=smtp.your.isp.com
SMTP_USER=
SMTP_PASSWORD=
2013-11-02 18:55:17 +01:00
## ---------- GENERAL BACKUP OPTIONS
## Max execution time of whole backup process. Soft max exec time generates a warning only.
## Hard max exec time generates a warning and stops the whole backup execution.
2013-06-14 22:27:11 +02:00
SOFT_MAX_EXEC_TIME_TOTAL=30000
HARD_MAX_EXEC_TIME_TOTAL=36000
2013-11-02 18:55:17 +01:00
## Backup Rotation. You may rotate backups if you don't use snapshots on your backup server.
2013-06-14 22:27:11 +02:00
ROTATE_BACKUPS=no
ROTATE_COPIES=7
2013-11-02 18:55:17 +01:00
## ---------- EXECUTION HOOKS
## Commands can will be run before and / or after backup execution (remote execution will only happen if REMOTE_BACKUP is set).
## This is usefull to make a snapshot before backing up data, or even handle snapshots of backed up data.
2013-06-16 13:54:20 +02:00
LOCAL_RUN_BEFORE_CMD=""
LOCAL_RUN_AFTER_CMD=""
REMOTE_RUN_BEFORE_CMD=""
REMOTE_RUN_AFTER_CMD=""
2013-11-02 18:55:17 +01:00
## Max execution time of commands before they get force killed. Leave 0 if you don't wan't this to happen. Time is specified in seconds.
2013-06-16 13:11:30 +02:00
MAX_EXEC_TIME_PER_CMD_BEFORE=0
MAX_EXEC_TIME_PER_CMD_AFTER=0
2013-11-02 18:55:17 +01:00
## Stops whole backup execution if one of the above commands fail
2013-09-11 16:21:22 +02:00
STOP_ON_CMD_ERROR=no