backup-rcopy/hosts/backup_script.sh.sample

176 lines
4.2 KiB
Bash

#!/usr/bin/env bash
# --------------------------------------------------- #
# -------------------- Variable --------------------- #
#
## --------------------------- ##
## - - ##
## - USER SETTINGS - ##
## - - ##
## --------------------------- ##
## - load default configuration
## -
. $rcopy_conf_file
. $rcopy_functions_file
## - set hostname, which is wanted to backup
## -
srcHost=<hostname (fqdn) or localhost>
## - sync via ssh tunnel
## -
## - if syncing via ssh sh_tunnel, create/modify file
## - ~/.ssh/config with the following contents
## -
## - host localhost
## - user back
## - Port 9999
## - ForwardAgent yes
## - StrictHostKeyChecking no
## - LogLevel FATAL
## -
## - NOTE !!
## - you cannot have different entries for localhost.
## -
## - A ssh tunnel localhost -> $target_host
## - will be created.
## -
ssh_tunnel=false
ssh_tunnel_local_port=9999
ssh_tunnel_target_port=22
ssh_tunnel_key_file=
## - if syncing via ssh hop-host, create/modify file
## - ~/.ssh/config with the following contents
## -
## - host localhost
## - user back
## - Port 9999
## - ForwardAgent yes
## - StrictHostKeyChecking no
## - LogLevel FATAL
## -
## - NOTE !!
## - you cannot have different entries for localhost.
## -
## - A ssh tunnel localhost -> $hop_host -> $target_host
## - will be created.
## -
ssh_hopping=false
ssh_hop_host=shell.so36.net
hop_host_port=1036
target_port=1036
local_port=9999
ssh_keyfile=$HOME/.ssh/id_dsa
## - remote user
## -
ssh_user=back
## - what to store ?
## -
## - these directories will be archived
## - into one file
##
dir_backup="<blank seperatet list of directories>"
## - backup network filesystems like nfs or smbfs
## -
## - NOTICE!
## - - mounting network devices is only possible on localhost - YET
## - - if network directory should mount, you need an entry in
## - /etc/fstab
## -
mount_netdir=false
net_mounted_dir_backup="<blank seperatet list of network directories>"
## - also store mysql databases ?
## -
mysql_backup=false
## - Since Version 5.6, giving password on command line is considered as insecure.
## - To avoid giving the password on command line, you can use an
## - encrypted option file instead.
## -
## - 1.) Create (encrypted) option file:
## - $ mysql_config_editor set --login-path=local --socket=/var/run/mysqld/mysqld.sock --user=backup --password
## - $ Password:
## -
## - 2.) Set environment variable mysql_credential_args="--login-path=local"
## - Now, the backup script uses the encrypted option file instead of (unencrypt) password
## - on command line.
mysql_credential_args="--login-path=local"
mysql_user=backup
mysql_password=backup
## - gzip mysql dump files?
## -
mysql_gzip=false
## - restart apache after mysqldump
## -
restart_apache=false
## - also store postresql databases ?
## -
pgsql_backup=false
pgsql_user=postgres
## - gzip postgres dump files?
## -
pgsql_gzip=false
## - store disk settings
## -
disksetting_backup=false
## - store svn repositories ?
## -
svn_backup=false
svn_source_base_path="<path-to-svn i.e. /data/svn>"
## - gzip SVN backup files?
## -
svn_gzip=false
## - give global rsync arguments here. maybe you wish
## - to exclude some files or diredtories
## -
#rsync_progArgs="--exclude *.log --exclude *.log.*.gz --delete-excluded "
#rsync_progArgs="--exclude **/dev/* --delete-excluded"
rsync_progArgs="--exclude **/dev/*random --exclude **/log/* --exclude **/logs/* --exclude **/sessions/* --delete-excluded"
## -----------------------------------------------------
## -
## - the following parameters overwrites the values from
## - the golbal configuration file
## - how long to hold backup-files ?
## -
#days=15
# a bigger (integer-)value for_DEBUG "1"results in more
# infomation, written to the logFile
#
# possible values: 0 , 1 or 2
#
#_DEBUG=0
# if _TEST is set to "1", nothing will be done. instead
# rsync will just report the actions it would have
# taken to the $logFile
#
#_TEST=0
export rcopy_functions_file srcHost ssh_user MIRROR ARCHIVE days _DEBUG _TEST ssh_hopping
## - Do the stuff - include main part of host script
## -
. $hosts_base_dir/scripts/main_part.include