Add syslog logging option for sequence ebackup
This commit is contained in:
@@ -5,6 +5,7 @@ toolBin=
|
||||
toolPpa="ppa:duplicity-team/duplicity-release-git"
|
||||
toolCronDir="/etc/cron.d"
|
||||
toolPrefix="encBackup_"
|
||||
toolSyslogTag=
|
||||
|
||||
# Get script working directory
|
||||
# (when called from a different directory)
|
||||
@@ -21,6 +22,7 @@ step_config() {
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
toolSyslogTag="${SCRIPT_NAME}-$SEQ_PROFILE_NAME"
|
||||
}
|
||||
|
||||
step_1_info() {
|
||||
@@ -39,6 +41,7 @@ step_1() {
|
||||
shift
|
||||
|
||||
local arg
|
||||
local retVal
|
||||
local dupArgs
|
||||
local purgeAfter=1
|
||||
|
||||
@@ -75,8 +78,11 @@ step_1() {
|
||||
checkInstalled
|
||||
setPassphrase
|
||||
exe $toolBin "${dupArgs[@]}" "$EBU_SOURCE" "$EBU_TARGET"
|
||||
retVal=$?
|
||||
unsetPassphrase
|
||||
|
||||
syslogEntry "Backup complete [$retVal]"
|
||||
|
||||
if [ $purgeAfter -ne 0 ] ; then
|
||||
step purge
|
||||
fi
|
||||
@@ -242,6 +248,7 @@ step_70() {
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo " [I] Update cron for profile $SEQ_PROFILE_NAME"
|
||||
exep "sudo echo \"$cronEntry\" > \"$cronScript\""
|
||||
syslogEntry "Cron file update complete [$EBU_CRONTIME]"
|
||||
else
|
||||
echo " [I] Cron for profile $SEQ_PROFILE_NAME is up to date"
|
||||
fi
|
||||
@@ -298,6 +305,12 @@ checkFileHead() {
|
||||
return 1
|
||||
}
|
||||
|
||||
syslogEntry() {
|
||||
if [ "$EBU_SYSLOG" == "true" ] ; then
|
||||
exe logger -t $toolSyslogTag "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
checkInstalled() {
|
||||
if [ -z "$toolBin" ] ; then
|
||||
command -v $toolName >>/dev/null
|
||||
|
Reference in New Issue
Block a user