Make local and sync tasks skipable.
This commit is contained in:
parent
6ede66fa5c
commit
242153b472
|
@ -36,8 +36,14 @@ SYSTEM=$(uname | tr '[:upper:]' '[:lower:]')
|
|||
PIDFILE="/var/run/evobackup.pid"
|
||||
LOGFILE="/var/log/evobackup.log"
|
||||
|
||||
## Enable/Disable tasks
|
||||
LOCAL_TASKS=1
|
||||
SYNC_TASKS=1
|
||||
|
||||
##### SETUP AND FUNCTIONS #############################################
|
||||
|
||||
BEGINNING=$(/bin/date +"%d-%m-%Y ; %H:%M")
|
||||
|
||||
# shellcheck disable=SC2174
|
||||
mkdir -p -m 700 ${LOCAL_BACKUP_DIR}
|
||||
|
||||
|
@ -121,6 +127,7 @@ trap "rm -f ${PIDFILE}" EXIT
|
|||
|
||||
##### LOCAL BACKUP ####################################################
|
||||
|
||||
if [ "${LOCAL_TASKS}" = "1" ]; then
|
||||
# You can comment or uncomment sections below to customize the backup
|
||||
|
||||
## OpenLDAP : example with slapcat
|
||||
|
@ -263,6 +270,8 @@ else
|
|||
##disklabel sd0 > ${LOCAL_BACKUP_DIR}/partitions
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
##### REMOTE BACKUP ###################################################
|
||||
|
||||
n=0
|
||||
|
@ -284,14 +293,14 @@ SSH_PORT=$(echo "${server}" | cut -d':' -f2)
|
|||
|
||||
HOSTNAME=$(hostname)
|
||||
|
||||
BEGINNING=$(/bin/date +"%d-%m-%Y ; %H:%M")
|
||||
|
||||
if [ "${SYSTEM}" = "linux" ]; then
|
||||
rep="/bin /boot /lib /opt /sbin /usr"
|
||||
else
|
||||
rep="/bsd /bin /sbin /usr"
|
||||
fi
|
||||
|
||||
|
||||
if [ "${SYNC_TASKS}" = "1" ]; then
|
||||
# /!\ DO NOT USE COMMENTS in the rsync command /!\
|
||||
# It breaks the command and destroys data, simply remove (or add) lines.
|
||||
|
||||
|
@ -334,15 +343,18 @@ rsync -avzh --stats --delete --delete-excluded --force --ignore-errors --partial
|
|||
-e "ssh -p ${SSH_PORT}" \
|
||||
"root@${SSH_SERVER}:/var/backup/" \
|
||||
| tail -30 >> $LOGFILE
|
||||
|
||||
END=$(/bin/date +"%d-%m-%Y ; %H:%M")
|
||||
fi
|
||||
|
||||
##### REPORTING #######################################################
|
||||
|
||||
printf "EvoBackup - %s - START %s ON %s\n" "${HOSTNAME}" "${BEGINNING}" "${SSH_SERVER}" \
|
||||
END=$(/bin/date +"%d-%m-%Y ; %H:%M")
|
||||
|
||||
printf "EvoBackup - %s - START %s ON %s (LOCAL_TASKS=%s SYNC_TASKS=%s)\n" \
|
||||
"${HOSTNAME}" "${BEGINNING}" "${SSH_SERVER}" "${LOCAL_TASKS}" "${SYNC_TASKS}" \
|
||||
>> $LOGFILE
|
||||
|
||||
printf "EvoBackup - %s - STOP %s ON %s\n" "${HOSTNAME}" "${END}" "${SSH_SERVER}" \
|
||||
printf "EvoBackup - %s - STOP %s ON %s (LOCAL_TASKS=%s SYNC_TASKS=%s)\n" \
|
||||
"${HOSTNAME}" "${END}" "${SSH_SERVER}" "${LOCAL_TASKS}" "${SYNC_TASKS}" \
|
||||
>> $LOGFILE
|
||||
|
||||
tail -10 $LOGFILE | \
|
||||
|
|
Loading…
Reference in a new issue