Compare commits
7 Commits
3eb272a2a3
...
master
Author | SHA1 | Date | |
---|---|---|---|
c1e4fbc75c | |||
9a548cdedc | |||
400d8b728c | |||
f2aab415d0 | |||
35b1e38dcc | |||
1c3bb571e1 | |||
dbe87cf75f |
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,9 +1,6 @@
|
||||
*.swp
|
||||
/conf/exclude_from.list
|
||||
/conf/logrotate.conf
|
||||
/conf/rcopy.conf
|
||||
/conf/manual_hosts.conf
|
||||
/conf/restore-website-from-backup.conf
|
||||
/conf/*.conf
|
||||
/conf/*.key
|
||||
/hosts/*.sh
|
||||
/hosts/BAK/*
|
||||
|
@ -1,280 +0,0 @@
|
||||
#######################################################
|
||||
## Configuration-file for remote backupscript ##
|
||||
#######################################################
|
||||
|
||||
# --------------------------------------------------- #
|
||||
# -------------------- Variable --------------------- #
|
||||
#
|
||||
|
||||
## - Lock directory exists, until the script ends. So
|
||||
## - we can check, if a previos instanze is already running.
|
||||
## -
|
||||
## - That directory is also userd for temporary files
|
||||
## -
|
||||
LOCK_DIR=/tmp/rcopy.lock
|
||||
|
||||
## --------------------------------------
|
||||
## - variables only used in parent script
|
||||
## -
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
BACKUP_HOST=`hostname -f`
|
||||
|
||||
HOME_DIR=$HOME
|
||||
AGENT=/tmp/.agent-$USER.sh
|
||||
|
||||
admin_email="argus@oopen.de"
|
||||
#from_address="backup@`hostname -f`"
|
||||
from_address="backup-ebs@oopen.de"
|
||||
company="EBS"
|
||||
content_type='Content-Type: text/plain;\n charset="utf-8"'
|
||||
|
||||
restart_samba_service=false
|
||||
samba_exe=/usr/local/samba/sbin/samba
|
||||
samba_init_script=/etc/init.d/samba4
|
||||
|
||||
|
||||
## --------------------------------
|
||||
## - variables, used in subshells..
|
||||
## -
|
||||
|
||||
#REMOTE_USER=back
|
||||
|
||||
crontab_base_dir=$rcopy_base_dir
|
||||
hosts_base_dir=$crontab_base_dir/hosts
|
||||
|
||||
rsync_exclude_file=${crontab_base_dir}/conf/exclude_from.list
|
||||
|
||||
|
||||
extern_usb_disk=true
|
||||
extern_sata_disk=false
|
||||
intern_disk=false
|
||||
# - remote_disk
|
||||
# -
|
||||
# - - You need a fstab-entry in order to mount the backup partition
|
||||
# - - Configure 'backup_mountpoint'
|
||||
# -
|
||||
remote_disk=false
|
||||
|
||||
## - if backup partion cannot be determined, try this one..
|
||||
## -
|
||||
_backup_partition="/dev/sdg1"
|
||||
backup_mountpoint="/mnt/backup"
|
||||
|
||||
## - Should check, if backup partion is mounted ? usefull if
|
||||
## - backup partion is not automounted after restart.
|
||||
## -
|
||||
check_mountpoint=false
|
||||
|
||||
base_label_name="Backup-EBS"
|
||||
|
||||
|
||||
## - if encrypted backup partition
|
||||
## -
|
||||
crypto_backup_device=true
|
||||
crypto_key_file="/data/.keys/backup.key"
|
||||
backup_partition_name=backup
|
||||
#mount_flags="-o user_xattr,acl,barrier=1"
|
||||
mount_flags=""
|
||||
|
||||
|
||||
backup_partition=
|
||||
disk_identifier=
|
||||
_found=false
|
||||
|
||||
if $crypto_backup_device ; then
|
||||
|
||||
backup_raw_partition=$_backup_partition
|
||||
backup_partition="/dev/mapper/${backup_partition_name}"
|
||||
|
||||
elif $extern_usb_disk || $extern_sata_disk || $intern_disk ; then
|
||||
|
||||
## - In case of unencrypted (and labeled) extern backup disc
|
||||
## -
|
||||
if [ -d "/dev/disk/by-label" ]; then
|
||||
backup_partition=$(realpath /dev/disk/by-label/`ls /dev/disk/by-label | grep -i $base_label_name`)
|
||||
[[ "X${backup_partition}" != "X$(realpath /dev/disk/by-label/)" ]] && _found=true
|
||||
fi
|
||||
|
||||
## - Otherwise, assuming the backup disc is the alphabetic last attached device
|
||||
## - in device list
|
||||
## -
|
||||
if ! $_found ; then
|
||||
|
||||
for file in `ls /dev/disk/by-uuid` ; do
|
||||
_disk=`basename $(realpath /dev/disk/by-uuid/$file) | grep -e "^sd"`
|
||||
[[ "X" = "${_disk}X" ]] && continue
|
||||
[[ "$disk_identifier" < "$_disk" ]] && disk_identifier=$_disk
|
||||
done
|
||||
|
||||
if [ "X$disk_identifier" = "X" ]; then
|
||||
|
||||
## - Backup device could not be detected, so we will try the (above) given one..
|
||||
## -
|
||||
backup_partition=$_backup_partition
|
||||
|
||||
else
|
||||
backup_partition=/dev/$disk_identifier
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
elif $remote_disk ; then
|
||||
|
||||
backup_resource="$(grep "$backup_mountpoint" /etc/fstab | grep -v -E "\s*#" | awk '{print$1}' | head -1)"
|
||||
|
||||
fi
|
||||
|
||||
## - send reminder for changing the backup disk
|
||||
## -
|
||||
#send_reminder=true
|
||||
send_reminder=true
|
||||
reminder_day="Montag" ## - maybe you have set to "Monday"
|
||||
reminder_email="kontakt@kanzlei-ebs.de"
|
||||
reminder_email_2=""
|
||||
|
||||
backup_base_dir=${backup_mountpoint}/backup
|
||||
#backup_base_dir=/backup
|
||||
|
||||
## - logging backup durations in an different file
|
||||
## - NOTICE:
|
||||
## - because of the process number in the filename, take care, not to
|
||||
## - override it by child processes, which also read this file
|
||||
## -
|
||||
## - for a better looking, define a right hand tab stop
|
||||
## -
|
||||
if [ -z "$logDuration" ];then
|
||||
logDuration=${LOCK_DIR}/duration.log
|
||||
fi
|
||||
right_tabstop=60
|
||||
|
||||
|
||||
info_file="/tmp/LAST_BACKUP_archiv.info"
|
||||
> $info_file
|
||||
|
||||
|
||||
## - Give global rsync arguments here. Maybe you wish
|
||||
## - to exclude some files or diredtories
|
||||
## -
|
||||
## - Exclude from transfering
|
||||
## -
|
||||
## - **/dev/*random
|
||||
## - *.log
|
||||
## - *.log.[0-9]
|
||||
## - *.log.[0-9],gz
|
||||
## - *.log.[0-9][0-9].gz
|
||||
## - **/sessions/*
|
||||
## - **/*.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]*
|
||||
## -
|
||||
rsync_progArgs="
|
||||
--exclude **/dev/*random
|
||||
--exclude *.log
|
||||
--exclude *.log.[0-9]
|
||||
--exclude *.log.[0-9].gz
|
||||
--exclude *.log.[0-9][0-9].gz
|
||||
--exclude **/sessions/*
|
||||
--exclude 'System Volume Information'
|
||||
--delete-excluded
|
||||
"
|
||||
|
||||
#if [ ! -s "${rsync_exclude_file}" ]; then
|
||||
# rsync_progArgs="${rsync_progArgs} --exclude-from=${rsync_exclude_file}"
|
||||
#fi
|
||||
#rsyncExclude=("/System Volume Information/")
|
||||
|
||||
## - Note:
|
||||
## - If backup device is on remote host, then rsync needs arguments:
|
||||
## -
|
||||
if $remote_disk ; then
|
||||
rsync_progArgs="--omit-link-times --munge-links $rsync_progArgs"
|
||||
fi
|
||||
|
||||
|
||||
## - force to create level 1 backups. the backups are not cascaded, they
|
||||
## - all are direct related to the complete one.
|
||||
## -
|
||||
force_level_1=true
|
||||
|
||||
|
||||
## - What to do
|
||||
## - Note: 1) without mirroring no archiving will be done
|
||||
## - 2) in case of database backup only the parameter
|
||||
## - "MIRROR" will be considered
|
||||
## -
|
||||
MIRROR=true
|
||||
ARCHIVE=true
|
||||
|
||||
## - 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 LOCK_DIR admin_email from_address content_type company hosts_base_dir intern_disk extern_usb_disk extern_sata_disk remote_disk crypto_backup_device backup_base_dir backup_partition backup_resource check_mountpoint info_file logFile logDuration right_tabstop disk_label_log_file rsync_progArgs force_level_1 MIRROR ARCHIVE days _DEBUG _TEST
|
||||
|
||||
#
|
||||
# ------------------ Ende Variable ------------------ #
|
||||
# --------------------------------------------------- #
|
||||
|
||||
|
||||
|
||||
# --------------------------------------------------- #
|
||||
# -------------------- Programme -------------------- #
|
||||
#
|
||||
basename=`which basename`
|
||||
dirname=`which dirname`
|
||||
awk=`which awk`
|
||||
cat=`which cat`
|
||||
cryptsetup=`which cryptsetup`
|
||||
cut=`which cut`
|
||||
date=`which date`
|
||||
dd=`which dd`
|
||||
e2fsck=`which e2fsck`
|
||||
find=`which find`
|
||||
fdisk=`which fdisk`
|
||||
grep=`which grep`
|
||||
gzip=`which gzip`
|
||||
hdparm=`which hdparm`
|
||||
logrotate=`which logrotate`
|
||||
mkdir=`which mkdir`
|
||||
mount=`which mount`
|
||||
mv=`which mv`
|
||||
parted=`which parted`
|
||||
ps=`which ps`
|
||||
rm=`which rm`
|
||||
rsync=`which rsync`
|
||||
scp=`which scp`
|
||||
sgdisk=`which sgdisk`
|
||||
ssh=`which ssh`
|
||||
sort=`which sort`
|
||||
tar=`which tar`
|
||||
tune2fs=`which tune2fs`
|
||||
umount=`which umount`
|
||||
sfdisk=`which sfdisk`
|
||||
su=`which su`
|
||||
sudo=`which sudo`
|
||||
sort=`which sort`
|
||||
sync=`which sync`
|
||||
touch=`which touch`
|
||||
|
||||
ssh_opts='-o ControlMaster=auto -o ControlPath=/root/.ssh/%r@%h:%p -o ControlPersist=60'
|
||||
if [[ -n "$ssh" ]] ; then
|
||||
ssh="$ssh -n $ssh_opts"
|
||||
fi
|
||||
|
||||
export basename dirname awk cat cryptsetup cut date dd e2fsck find fdisk grep gzip hdparm logrotate mkdir mount mv parted ps rm rsync scp ssh sort tar tune2fs umount sfdisk sgdisk su sudo sort sync touch
|
||||
#
|
||||
# ------------------ Ende Programme ----------------- #
|
||||
# --------------------------------------------------- #
|
@ -1,276 +0,0 @@
|
||||
#######################################################
|
||||
## Configuration-file for remote backupscript ##
|
||||
#######################################################
|
||||
|
||||
# --------------------------------------------------- #
|
||||
# -------------------- Variable --------------------- #
|
||||
#
|
||||
|
||||
## - Lock directory exists, until the script ends. So
|
||||
## - we can check, if a previos instanze is already running.
|
||||
## -
|
||||
## - That directory is also userd for temporary files
|
||||
## -
|
||||
LOCK_DIR=/tmp/rcopy.lock
|
||||
|
||||
## --------------------------------------
|
||||
## - variables only used in parent script
|
||||
## -
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
BACKUP_HOST=`hostname -f`
|
||||
|
||||
HOME_DIR=$HOME
|
||||
AGENT=/tmp/.agent-$USER.sh
|
||||
|
||||
admin_email="argus@oopen.de"
|
||||
from_address="backup@`hostname -f`"
|
||||
company="o.open"
|
||||
content_type='Content-Type: text/plain;\n charset="utf-8"'
|
||||
|
||||
restart_samba_service=false
|
||||
samba_exe=/usr/local/samba/sbin/samba
|
||||
samba_init_script=/etc/init.d/samba4
|
||||
|
||||
|
||||
## --------------------------------
|
||||
## - variables, used in subshells..
|
||||
## -
|
||||
|
||||
#REMOTE_USER=back
|
||||
|
||||
crontab_base_dir=$rcopy_base_dir
|
||||
hosts_base_dir=$crontab_base_dir/hosts
|
||||
|
||||
|
||||
extern_usb_disk=false
|
||||
extern_sata_disk=false
|
||||
|
||||
# - A separate disk for backups that must be mounted for the backup process.
|
||||
# -
|
||||
intern_disk=false
|
||||
|
||||
# - remote_disk
|
||||
# -
|
||||
# - - You need a fstab-entry in order to mount the backup partition
|
||||
# - - Configure 'backup_mountpoint'
|
||||
# -
|
||||
remote_disk=false
|
||||
|
||||
## - if backup partion cannot be determined, try this one..
|
||||
## -
|
||||
_backup_partition="<BACKUP_PARTITION>"
|
||||
backup_mountpoint="<BACKUP_MOUNTPOINT>"
|
||||
|
||||
## - Should check, if backup partion is mounted ? usefull if
|
||||
## - backup partion is not automounted after restart.
|
||||
## -
|
||||
check_mountpoint=false
|
||||
|
||||
base_label_name="<BACKUP-AH>"
|
||||
|
||||
|
||||
## - if encrypted backup partition
|
||||
## -
|
||||
crypto_backup_device=false
|
||||
crypto_key_file="<CRYPTO_KEY_FILE>"
|
||||
backup_partition_name=backup
|
||||
#mount_flags="-o user_xattr,acl,barrier=1"
|
||||
mount_flags=""
|
||||
|
||||
|
||||
backup_partition=
|
||||
disk_identifier=
|
||||
_found=false
|
||||
|
||||
if $crypto_backup_device ; then
|
||||
|
||||
backup_raw_partition=$_backup_partition
|
||||
backup_partition="/dev/mapper/${backup_partition_name}"
|
||||
|
||||
elif $extern_usb_disk || $extern_sata_disk || $intern_disk ; then
|
||||
|
||||
## - In case of unencrypted (and labeled) extern backup disc
|
||||
## -
|
||||
if [ -d "/dev/disk/by-label" ]; then
|
||||
backup_partition=$(realpath /dev/disk/by-label/`ls /dev/disk/by-label | grep -i $base_label_name`)
|
||||
[[ "X${backup_partition}" != "X$(realpath /dev/disk/by-label/)" ]] && _found=true
|
||||
fi
|
||||
|
||||
## - Otherwise, assuming the backup disc is the alphabetic last attached device
|
||||
## - in device list
|
||||
## -
|
||||
if ! $_found ; then
|
||||
|
||||
for file in `ls /dev/disk/by-uuid` ; do
|
||||
_disk=`basename $(realpath /dev/disk/by-uuid/$file) | grep -e "^sd"`
|
||||
[[ "X" = "${_disk}X" ]] && continue
|
||||
[[ "$disk_identifier" < "$_disk" ]] && disk_identifier=$_disk
|
||||
done
|
||||
|
||||
if [ "X$disk_identifier" = "X" ]; then
|
||||
|
||||
## - Backup device could not be detected, so we will try the (above) given one..
|
||||
## -
|
||||
backup_partition=$_backup_partition
|
||||
|
||||
else
|
||||
backup_partition=/dev/$disk_identifier
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
elif $remote_disk ; then
|
||||
|
||||
backup_resource="$(grep "$backup_mountpoint" /etc/fstab | grep -v -E "\s*#" | awk '{print$1}' | head -1)"
|
||||
|
||||
fi
|
||||
|
||||
## - send reminder for changing the backup disk
|
||||
## -
|
||||
#send_reminder=true
|
||||
send_reminder=false
|
||||
reminder_day="Montag" ## - maybe you have set to "Monday"
|
||||
reminder_email="<REMINDER_EMAIL>"
|
||||
reminder_email_2=""
|
||||
|
||||
#backup_base_dir=${backup_mountpoint}/backup
|
||||
backup_base_dir=/backup
|
||||
|
||||
## - logging backup durations in an different file
|
||||
## - NOTICE:
|
||||
## - because of the process number in the filename, take care, not to
|
||||
## - override it by child processes, which also read this file
|
||||
## -
|
||||
## - for a better looking, define a right hand tab stop
|
||||
## -
|
||||
if [ -z "$logDuration" ];then
|
||||
logDuration=${LOCK_DIR}/duration.log
|
||||
fi
|
||||
right_tabstop=65
|
||||
|
||||
|
||||
info_file="/tmp/LAST_BACKUP_archiv.info"
|
||||
> $info_file
|
||||
|
||||
|
||||
## - Give global rsync arguments here. Maybe you wish
|
||||
## - to exclude some files or diredtories
|
||||
## -
|
||||
## - Exclude from transfering
|
||||
## -
|
||||
## - **/dev/*random
|
||||
## - *.log
|
||||
## - *.log.[0-9]
|
||||
## - *.log.[0-9],gz
|
||||
## - *.log.[0-9][0-9].gz
|
||||
## - **/sessions/*
|
||||
## - **/*.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]*
|
||||
## -
|
||||
rsync_progArgs="
|
||||
--exclude **/dev/*random
|
||||
--exclude *.log
|
||||
--exclude *.log.[0-9]
|
||||
--exclude *.log.[0-9].gz
|
||||
--exclude *.log.[0-9][0-9].gz
|
||||
--exclude **/sessions/*
|
||||
--exclude **/*.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]*
|
||||
--delete-excluded
|
||||
"
|
||||
|
||||
## - Note:
|
||||
## - If backup device is on remote host, then rsync needs arguments:
|
||||
## -
|
||||
if $remote_disk ; then
|
||||
rsync_progArgs="--omit-link-times --munge-links $rsync_progArgs"
|
||||
fi
|
||||
|
||||
|
||||
## - force to create level 1 backups. the backups are not cascaded, they
|
||||
## - all are direct related to the complete one.
|
||||
## -
|
||||
force_level_1=true
|
||||
|
||||
|
||||
## - What to do
|
||||
## - Note: 1) without mirroring no archiving will be done
|
||||
## - 2) in case of database backup only the parameter
|
||||
## - "MIRROR" will be considered
|
||||
## -
|
||||
MIRROR=true
|
||||
ARCHIVE=true
|
||||
|
||||
## - how long to hold backup-files ?
|
||||
## -
|
||||
days=14
|
||||
|
||||
# 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 LOCK_DIR admin_email from_address content_type company hosts_base_dir intern_disk extern_usb_disk extern_sata_disk remote_disk crypto_backup_device backup_base_dir backup_partition backup_resource check_mountpoint info_file logFile logDuration right_tabstop disk_label_log_file rsync_progArgs force_level_1 MIRROR ARCHIVE days _DEBUG _TEST
|
||||
|
||||
#
|
||||
# ------------------ Ende Variable ------------------ #
|
||||
# --------------------------------------------------- #
|
||||
|
||||
|
||||
|
||||
# --------------------------------------------------- #
|
||||
# -------------------- Programme -------------------- #
|
||||
#
|
||||
basename=`which basename`
|
||||
dirname=`which dirname`
|
||||
awk=`which awk`
|
||||
cat=`which cat`
|
||||
cryptsetup=`which cryptsetup`
|
||||
cut=`which cut`
|
||||
date=`which date`
|
||||
dd=`which dd`
|
||||
e2fsck=`which e2fsck`
|
||||
find=`which find`
|
||||
fdisk=`which fdisk`
|
||||
grep=`which grep`
|
||||
gzip=`which gzip`
|
||||
hdparm=`which hdparm`
|
||||
logrotate=`which logrotate`
|
||||
mkdir=`which mkdir`
|
||||
mount=`which mount`
|
||||
mv=`which mv`
|
||||
parted=`which parted`
|
||||
ps=`which ps`
|
||||
rm=`which rm`
|
||||
rsync=`which rsync`
|
||||
scp=`which scp`
|
||||
sgdisk=`which sgdisk`
|
||||
ssh=`which ssh`
|
||||
sort=`which sort`
|
||||
tar=`which tar`
|
||||
tune2fs=`which tune2fs`
|
||||
umount=`which umount`
|
||||
sfdisk=`which sfdisk`
|
||||
su=`which su`
|
||||
sudo=`which sudo`
|
||||
sort=`which sort`
|
||||
sync=`which sync`
|
||||
touch=`which touch`
|
||||
|
||||
ssh_opts='-o ControlMaster=auto -o ControlPath=/root/.ssh/%r@%h:%p -o ControlPersist=60'
|
||||
if [[ -n "$ssh" ]] ; then
|
||||
ssh="$ssh -n $ssh_opts"
|
||||
fi
|
||||
|
||||
export basename dirname awk cat cryptsetup cut date dd e2fsck find fdisk grep gzip hdparm logrotate mkdir mount mv parted ps rm rsync scp ssh sort tar tune2fs umount sfdisk sgdisk su sudo sort sync touch
|
||||
#
|
||||
# ------------------ Ende Programme ----------------- #
|
||||
# --------------------------------------------------- #
|
@ -86,12 +86,7 @@ backup_partition=
|
||||
disk_identifier=
|
||||
_found=false
|
||||
|
||||
if $crypto_backup_device ; then
|
||||
|
||||
backup_raw_partition=$_backup_partition
|
||||
backup_partition="/dev/mapper/${backup_partition_name}"
|
||||
|
||||
elif $extern_usb_disk || $extern_sata_disk || $intern_disk ; then
|
||||
if $extern_usb_disk || $extern_sata_disk || $intern_disk ; then
|
||||
|
||||
## - In case of unencrypted (and labeled) extern backup disc
|
||||
## -
|
||||
@ -115,10 +110,20 @@ elif $extern_usb_disk || $extern_sata_disk || $intern_disk ; then
|
||||
|
||||
## - Backup device could not be detected, so we will try the (above) given one..
|
||||
## -
|
||||
backup_partition=$_backup_partition
|
||||
backup_raw_partition=$_backup_partition
|
||||
#backup_partition=$_backup_partition
|
||||
|
||||
else
|
||||
backup_partition=/dev/$disk_identifier
|
||||
backup_raw_partition=/dev/$disk_identifier
|
||||
#backup_partition=/dev/$disk_identifier
|
||||
fi
|
||||
|
||||
if $(cryptsetup isLuks $backup_raw_partition) ; then
|
||||
crypto_backup_device=true
|
||||
backup_partition="/dev/mapper/${backup_partition_name}"
|
||||
else
|
||||
crypto_backup_device=false
|
||||
backup_partition=$backup_raw_partition
|
||||
fi
|
||||
|
||||
fi
|
||||
|
@ -1,264 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# --------------------------------------------------- #
|
||||
# -------------------- Variable --------------------- #
|
||||
#
|
||||
|
||||
## --------------------------- ##
|
||||
## - - ##
|
||||
## - USER SETTINGS - ##
|
||||
## - - ##
|
||||
## --------------------------- ##
|
||||
|
||||
## - load default configuration
|
||||
## -
|
||||
. $rcopy_conf_file
|
||||
. $rcopy_functions_file
|
||||
|
||||
## - set hostname, which is wanted to backup
|
||||
## -
|
||||
srcHost=mx.warenform.de
|
||||
|
||||
|
||||
## - 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="/etc /home /root /var/spool/vacation /var/spool/cron /var/vmail /var/www /usr/local/dovecot/etc/dovecot /usr/local/apache2/conf /var/lib/dehydrated"
|
||||
|
||||
## - 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=/tmp/mysql.sock --user=backup --password
|
||||
## - $ Password:
|
||||
## -
|
||||
## - Its possible to hold more than one credentials in this (encrypted) option file:
|
||||
## - $ mysql_config_editor set --login-path=local-5.6 --socket=/tmp/mysql-5.6.sock --user=backup --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.
|
||||
## -
|
||||
## - You can backup databases from different mysql installations i.e. for a (main)
|
||||
## - MySQL installation and a second one using variable 'mysql_credential_args_arr':
|
||||
## -
|
||||
## - mysql_credential_args_arr=("<Name1>:<MySQL credentials1>" ""<Name1>:<MySQL credentials2>" ...
|
||||
## -
|
||||
## - Example:
|
||||
## - mysql_credential_args_arr=("5.7:--login-path=local" "5.6:--login-path=local-5.6")
|
||||
## -
|
||||
#mysql_credential_args_arr=""
|
||||
mysql_credential_args="--login-path=local"
|
||||
mysql_user=backup
|
||||
mysql_password=backup
|
||||
|
||||
## - gzip mysql dump files?
|
||||
## -
|
||||
mysql_gzip=false
|
||||
|
||||
## - mysql_max_allowed_packet
|
||||
## -
|
||||
## - Set / Change MySQL System Variable '--max-allowed-packet'
|
||||
## -
|
||||
## - i.e. prevents errors like:
|
||||
## -
|
||||
## - When a client server receives larger packet bytes, an error occurs. The connection faces
|
||||
## - ER_NET_PACKET_TOO_LARGE error a
|
||||
## - nd closes instantly.
|
||||
## -
|
||||
## - Another error can be
|
||||
## - Lost Connection to Server During Query Error.
|
||||
## - It has the same reason, i.e., a large communication packet.
|
||||
## -
|
||||
mysql_max_allowed_packet='512M'
|
||||
|
||||
|
||||
## - restart apache after mysqldump
|
||||
## -
|
||||
restart_apache=false
|
||||
|
||||
## - also store postresql databases ?
|
||||
## -
|
||||
pgsql_backup=true
|
||||
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
|
||||
|
||||
|
||||
## - backup nextcloud accounts
|
||||
## -
|
||||
nextcloud_backup=false
|
||||
|
||||
## - nextcloud_server_url
|
||||
## -
|
||||
nextcloud_server_url="https://${srcHost}"
|
||||
|
||||
## - nextcloud_accounts
|
||||
## -
|
||||
## - !! Notice !!
|
||||
## - ============
|
||||
## - - delemiter between fields is th backtick sign: '`'
|
||||
## - - single AND double quote sign CANNOT BE USED as a sign inside a field
|
||||
## - - the single quote sign is used as begin/end sign for this variable
|
||||
## -
|
||||
## - nextcloud_accounts='<name1>`<password1>[`server_url] [<name2`password2>[`server_url] [..'
|
||||
## -
|
||||
## - Notice:
|
||||
## - if 'server_url' is ommited, the value of variable 'nextcloud_server_url', the
|
||||
## - default on, will be used.
|
||||
## -
|
||||
## - Example:
|
||||
## -
|
||||
## - nextcloud_accounts='
|
||||
## - user1`P4ssw0rd1
|
||||
## - user2`P4ssw0rd2`non-default-cloud-server-url
|
||||
## - '
|
||||
## -
|
||||
nextcloud_accounts=''
|
||||
|
||||
|
||||
## - Give rsync arguments here. Maybe you wish
|
||||
## - to exclude some files or diredtories
|
||||
## -
|
||||
## - Note:
|
||||
## - (Global) rsync options are already defined. See file 'conf/rcopy.conf'
|
||||
## -
|
||||
## - Add rsync options:
|
||||
## -
|
||||
#rsync_progArgs="$rsync_progArgs <more rsync options>"
|
||||
|
||||
## - replace #rsync_progArgs
|
||||
## -
|
||||
## - Note:
|
||||
## - If backup device is on remote host, then rsync needs arguments:
|
||||
## -
|
||||
## - "--omit-link-times --munge-links"
|
||||
## -
|
||||
## - This is Added automaticaly done in file rcopy.conf and looks liek:
|
||||
## -
|
||||
## - if $remote_disk ; then
|
||||
## - rsync_progArgs="--omit-link-times --munge-links $rsync_progArgs"
|
||||
## - fi
|
||||
## -
|
||||
## - Take care to add this here if needed and rsync_progArgs are replaced!!
|
||||
## -
|
||||
#rsync_progArgs="<your-rsync-optargs>""
|
||||
#
|
||||
#if $remote_disk ; then
|
||||
# rsync_progArgs="--omit-link-times --munge-links $rsync_progArgs"
|
||||
#fi
|
||||
|
||||
|
||||
## -----------------------------------------------------
|
||||
## -
|
||||
## - 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
|
@ -1,264 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# --------------------------------------------------- #
|
||||
# -------------------- Variable --------------------- #
|
||||
#
|
||||
|
||||
## --------------------------- ##
|
||||
## - - ##
|
||||
## - USER SETTINGS - ##
|
||||
## - - ##
|
||||
## --------------------------- ##
|
||||
|
||||
## - load default configuration
|
||||
## -
|
||||
. $rcopy_conf_file
|
||||
. $rcopy_functions_file
|
||||
|
||||
## - set hostname, which is wanted to backup
|
||||
## -
|
||||
srcHost=web0.warenform.de
|
||||
|
||||
|
||||
## - 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="/etc /home /root /usr/local/apache2/conf /var/lib/dehydrated /var/www/html /var/spool/cron"
|
||||
|
||||
## - 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=true
|
||||
|
||||
## - 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=/tmp/mysql.sock --user=backup --password
|
||||
## - $ Password:
|
||||
## -
|
||||
## - Its possible to hold more than one credentials in this (encrypted) option file:
|
||||
## - $ mysql_config_editor set --login-path=local-5.6 --socket=/tmp/mysql-5.6.sock --user=backup --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.
|
||||
## -
|
||||
## - You can backup databases from different mysql installations i.e. for a (main)
|
||||
## - MySQL installation and a second one using variable 'mysql_credential_args_arr':
|
||||
## -
|
||||
## - mysql_credential_args_arr=("<Name1>:<MySQL credentials1>" ""<Name1>:<MySQL credentials2>" ...
|
||||
## -
|
||||
## - Example:
|
||||
## - mysql_credential_args_arr=("5.7:--login-path=local" "5.6:--login-path=local-5.6")
|
||||
## -
|
||||
#mysql_credential_args_arr=""
|
||||
#mysql_credential_args="--login-path=local"
|
||||
mysql_user=backup
|
||||
mysql_password=backup
|
||||
|
||||
## - gzip mysql dump files?
|
||||
## -
|
||||
mysql_gzip=false
|
||||
|
||||
## - mysql_max_allowed_packet
|
||||
## -
|
||||
## - Set / Change MySQL System Variable '--max-allowed-packet'
|
||||
## -
|
||||
## - i.e. prevents errors like:
|
||||
## -
|
||||
## - When a client server receives larger packet bytes, an error occurs. The connection faces
|
||||
## - ER_NET_PACKET_TOO_LARGE error a
|
||||
## - nd closes instantly.
|
||||
## -
|
||||
## - Another error can be
|
||||
## - Lost Connection to Server During Query Error.
|
||||
## - It has the same reason, i.e., a large communication packet.
|
||||
## -
|
||||
mysql_max_allowed_packet='512M'
|
||||
|
||||
|
||||
## - 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
|
||||
|
||||
|
||||
## - backup nextcloud accounts
|
||||
## -
|
||||
nextcloud_backup=false
|
||||
|
||||
## - nextcloud_server_url
|
||||
## -
|
||||
nextcloud_server_url="https://${srcHost}"
|
||||
|
||||
## - nextcloud_accounts
|
||||
## -
|
||||
## - !! Notice !!
|
||||
## - ============
|
||||
## - - delemiter between fields is th backtick sign: '`'
|
||||
## - - single AND double quote sign CANNOT BE USED as a sign inside a field
|
||||
## - - the single quote sign is used as begin/end sign for this variable
|
||||
## -
|
||||
## - nextcloud_accounts='<name1>`<password1>[`server_url] [<name2`password2>[`server_url] [..'
|
||||
## -
|
||||
## - Notice:
|
||||
## - if 'server_url' is ommited, the value of variable 'nextcloud_server_url', the
|
||||
## - default on, will be used.
|
||||
## -
|
||||
## - Example:
|
||||
## -
|
||||
## - nextcloud_accounts='
|
||||
## - user1`P4ssw0rd1
|
||||
## - user2`P4ssw0rd2`non-default-cloud-server-url
|
||||
## - '
|
||||
## -
|
||||
nextcloud_accounts=''
|
||||
|
||||
|
||||
## - Give rsync arguments here. Maybe you wish
|
||||
## - to exclude some files or diredtories
|
||||
## -
|
||||
## - Note:
|
||||
## - (Global) rsync options are already defined. See file 'conf/rcopy.conf'
|
||||
## -
|
||||
## - Add rsync options:
|
||||
## -
|
||||
#rsync_progArgs="$rsync_progArgs <more rsync options>"
|
||||
|
||||
## - replace #rsync_progArgs
|
||||
## -
|
||||
## - Note:
|
||||
## - If backup device is on remote host, then rsync needs arguments:
|
||||
## -
|
||||
## - "--omit-link-times --munge-links"
|
||||
## -
|
||||
## - This is Added automaticaly done in file rcopy.conf and looks liek:
|
||||
## -
|
||||
## - if $remote_disk ; then
|
||||
## - rsync_progArgs="--omit-link-times --munge-links $rsync_progArgs"
|
||||
## - fi
|
||||
## -
|
||||
## - Take care to add this here if needed and rsync_progArgs are replaced!!
|
||||
## -
|
||||
#rsync_progArgs="<your-rsync-optargs>""
|
||||
#
|
||||
#if $remote_disk ; then
|
||||
# rsync_progArgs="--omit-link-times --munge-links $rsync_progArgs"
|
||||
#fi
|
||||
|
||||
|
||||
## -----------------------------------------------------
|
||||
## -
|
||||
## - 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
|
@ -1,264 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# --------------------------------------------------- #
|
||||
# -------------------- Variable --------------------- #
|
||||
#
|
||||
|
||||
## --------------------------- ##
|
||||
## - - ##
|
||||
## - USER SETTINGS - ##
|
||||
## - - ##
|
||||
## --------------------------- ##
|
||||
|
||||
## - load default configuration
|
||||
## -
|
||||
. $rcopy_conf_file
|
||||
. $rcopy_functions_file
|
||||
|
||||
## - set hostname, which is wanted to backup
|
||||
## -
|
||||
srcHost=nd.warenform.de
|
||||
|
||||
|
||||
## - 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="/etc /home /root /usr/local/apache2/conf /var/www/html/projekte /var/www/html/.gnupg /var/www/html/.ssh /var/spool/cron /var/lib/dehydrated"
|
||||
|
||||
## - 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=true
|
||||
|
||||
## - 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=/tmp/mysql.sock --user=backup --password
|
||||
## - $ Password:
|
||||
## -
|
||||
## - Its possible to hold more than one credentials in this (encrypted) option file:
|
||||
## - $ mysql_config_editor set --login-path=local-5.6 --socket=/tmp/mysql-5.6.sock --user=backup --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.
|
||||
## -
|
||||
## - You can backup databases from different mysql installations i.e. for a (main)
|
||||
## - MySQL installation and a second one using variable 'mysql_credential_args_arr':
|
||||
## -
|
||||
## - mysql_credential_args_arr=("<Name1>:<MySQL credentials1>" ""<Name1>:<MySQL credentials2>" ...
|
||||
## -
|
||||
## - Example:
|
||||
## - mysql_credential_args_arr=("5.7:--login-path=local" "5.6:--login-path=local-5.6")
|
||||
## -
|
||||
#mysql_credential_args_arr=""
|
||||
#mysql_credential_args="--login-path=local"
|
||||
mysql_user=backup
|
||||
mysql_password=backup
|
||||
|
||||
## - gzip mysql dump files?
|
||||
## -
|
||||
mysql_gzip=false
|
||||
|
||||
## - mysql_max_allowed_packet
|
||||
## -
|
||||
## - Set / Change MySQL System Variable '--max-allowed-packet'
|
||||
## -
|
||||
## - i.e. prevents errors like:
|
||||
## -
|
||||
## - When a client server receives larger packet bytes, an error occurs. The connection faces
|
||||
## - ER_NET_PACKET_TOO_LARGE error a
|
||||
## - nd closes instantly.
|
||||
## -
|
||||
## - Another error can be
|
||||
## - Lost Connection to Server During Query Error.
|
||||
## - It has the same reason, i.e., a large communication packet.
|
||||
## -
|
||||
mysql_max_allowed_packet='512M'
|
||||
|
||||
|
||||
## - 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
|
||||
|
||||
|
||||
## - backup nextcloud accounts
|
||||
## -
|
||||
nextcloud_backup=false
|
||||
|
||||
## - nextcloud_server_url
|
||||
## -
|
||||
nextcloud_server_url="https://${srcHost}"
|
||||
|
||||
## - nextcloud_accounts
|
||||
## -
|
||||
## - !! Notice !!
|
||||
## - ============
|
||||
## - - delemiter between fields is th backtick sign: '`'
|
||||
## - - single AND double quote sign CANNOT BE USED as a sign inside a field
|
||||
## - - the single quote sign is used as begin/end sign for this variable
|
||||
## -
|
||||
## - nextcloud_accounts='<name1>`<password1>[`server_url] [<name2`password2>[`server_url] [..'
|
||||
## -
|
||||
## - Notice:
|
||||
## - if 'server_url' is ommited, the value of variable 'nextcloud_server_url', the
|
||||
## - default on, will be used.
|
||||
## -
|
||||
## - Example:
|
||||
## -
|
||||
## - nextcloud_accounts='
|
||||
## - user1`P4ssw0rd1
|
||||
## - user2`P4ssw0rd2`non-default-cloud-server-url
|
||||
## - '
|
||||
## -
|
||||
nextcloud_accounts=''
|
||||
|
||||
|
||||
## - Give rsync arguments here. Maybe you wish
|
||||
## - to exclude some files or diredtories
|
||||
## -
|
||||
## - Note:
|
||||
## - (Global) rsync options are already defined. See file 'conf/rcopy.conf'
|
||||
## -
|
||||
## - Add rsync options:
|
||||
## -
|
||||
#rsync_progArgs="$rsync_progArgs <more rsync options>"
|
||||
|
||||
## - replace #rsync_progArgs
|
||||
## -
|
||||
## - Note:
|
||||
## - If backup device is on remote host, then rsync needs arguments:
|
||||
## -
|
||||
## - "--omit-link-times --munge-links"
|
||||
## -
|
||||
## - This is Added automaticaly done in file rcopy.conf and looks liek:
|
||||
## -
|
||||
## - if $remote_disk ; then
|
||||
## - rsync_progArgs="--omit-link-times --munge-links $rsync_progArgs"
|
||||
## - fi
|
||||
## -
|
||||
## - Take care to add this here if needed and rsync_progArgs are replaced!!
|
||||
## -
|
||||
#rsync_progArgs="<your-rsync-optargs>""
|
||||
#
|
||||
#if $remote_disk ; then
|
||||
# rsync_progArgs="--omit-link-times --munge-links $rsync_progArgs"
|
||||
#fi
|
||||
|
||||
|
||||
## -----------------------------------------------------
|
||||
## -
|
||||
## - 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
|
42
rcopy.sh
42
rcopy.sh
@ -251,40 +251,30 @@ elif $remote_disk ; then
|
||||
fi
|
||||
|
||||
|
||||
## - $AGENT muss (root) geh<65>ren und darf nicht beschreibbar sein
|
||||
## -
|
||||
# ---
|
||||
# SSH agent stuff
|
||||
## --
|
||||
|
||||
if [ ! -O $AGENT ] || ! ps ax | grep ssh-agent | grep -v grep > /dev/null ; then
|
||||
# Kill remaining ssh-agent processes if exists
|
||||
#
|
||||
if $(ps -U ${USER} -u ${USER} | ${grep} -q ssh-agent 2> /dev/null) ; then
|
||||
killall ssh-agent > /dev/null 2> /dev/null
|
||||
rm -f $AGENT
|
||||
eval "$(ssh-agent -s)" > /dev/null 2>&1 ; ssh-add ${SSH_KEY} > /dev/null 2>&1;
|
||||
#ssh-agent > $AGENT; . $AGENT > /dev/null ; ssh-add > /dev/null 2>&1
|
||||
unset SSH_AGENT_PID
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -O $AGENT ]; then
|
||||
# Run SSH-Agent as background process..
|
||||
#
|
||||
eval $(ssh-agent 2> /dev/null | tee ${AGENT}) > /dev/null
|
||||
|
||||
msg_00="\n[ Error ]: No file \"$AGENT\" for ssh-agent informations found or i'm not the owner !!"
|
||||
msg_01="\t ======================="
|
||||
msg_02="\t !! BACKUP INTERUPTED !!"
|
||||
msg_03="As user \"$USER\" do:\n\tssh-agent > $AGENT; . $AGENT; ssh-add"
|
||||
msg="${msg_00}\n\n${msg_01}\n${msg_02}\n${msg_01}\n\n${msg_03}"
|
||||
if $MANUAL ; then
|
||||
echo -e "\n$msg\n"
|
||||
else
|
||||
datum="$(date +"%d.%m.%Y")"
|
||||
subject="Backup Errors $company -- $datum"
|
||||
subject_utf8="$(echo "$subject" | iconv -t UTF8)"
|
||||
subject_utf8_encoded="=?utf-8?B?$(echo $subject_utf8 | base64 --wrap=0)?="
|
||||
echo -e "To:${admin_email}\n${content_type}\nSubject:${subject_utf8_encoded}\n${msg}\n" | /usr/sbin/sendmail -F "Errors BACKUP $company" -f $from_address $admin_email
|
||||
fi
|
||||
|
||||
exit 1
|
||||
fi
|
||||
. $AGENT > /dev/null 2>&1
|
||||
# Load the SSH private key into ssh agent
|
||||
#
|
||||
ssh-add -q ${SSH_KEY} 2> /dev/null
|
||||
|
||||
|
||||
if [ ! `$ps aux | $grep -e"^$USER" | $grep "$SSH_AGENT_PID" | $grep ssh-agent | awk '{print$2}'` ]; then
|
||||
# Check if ssh key was loaded
|
||||
#
|
||||
if ! $(ps -U ${USER} -u ${USER} | $grep "$SSH_AGENT_PID" | $grep -q ssh-agent 2> /dev/null) ; then
|
||||
|
||||
msg_00="\n[ Error ]: No Prozess for ssh-agent with Process ID \"$SSH_AGENT_PID\" found !!"
|
||||
msg_01="\t ======================="
|
||||
|
Reference in New Issue
Block a user