diff --git a/do-backup b/do-backup index 61487b2..4851024 100755 --- a/do-backup +++ b/do-backup @@ -3,6 +3,8 @@ # Copyright (c) 2023: # Darren 'Tadgy' Austin # Licensed under the terms of the GNU General Public License version 3. +# +# Perform backup tasks in a generic way. # Base configuration. BACKUP_MOUNTPOINT="/localdata" @@ -72,8 +74,8 @@ source /etc/mail.conf "backups" 2>/dev/null || { # Make sure BACKUP_MOUNTPOINT is a mountpoint. mountpoint "$BACKUP_MOUNTPOINT" >/dev/null 2>&1 || { - CONFIG_FILE="backups" /opt/bin/pushover -T "Backup" -p '-1' -m "Failure: $RSYNC_SOURCE" - mailx "${MAILX_ARGS[@]}" -S "from='$EMAIL_FROM'" -s "Backup failure: $RSYNC_SOURCE" "${EMAIL_TO[@]}" <<-EOF + [[ -x "/opt/bin/pushover" ]] && CONFIG_FILE="backups" /opt/bin/pushover -T "Backup" -p '-1' -m "Failure: $RSYNC_SOURCE" + [[ -n "${EMAIL_TO[*]}" ]] && mailx "${MAILX_ARGS[@]}" -S "from='$EMAIL_FROM'" -s "Backup failure: $RSYNC_SOURCE" "${EMAIL_TO[@]}" <<-EOF '$BACKUP_MOUNTPOINT' is not a mountpoint. EOF exit 1 @@ -85,8 +87,8 @@ ERR="$?" # Send a notification and mail a log if there were errors. (( ERR != 0 )) && (( ERR != 10 )) && (( ERR != 24 )) && { - CONFIG_FILE="backups" /opt/bin/pushover -T "Backup" -p '-1' -m "Failure: $RSYNC_SOURCE" - mailx "${MAILX_ARGS[@]}" -S "from='$EMAIL_FROM'" -s "Backup failure: $RSYNC_SOURCE" "${EMAIL_TO[@]}" <<-EOF + [[ -x "/opt/bin/pushover" ]] && CONFIG_FILE="backups" /opt/bin/pushover -T "Backup" -p '-1' -m "Failure: $RSYNC_SOURCE" + [[ -n "${EMAIL_TO[*]}" ]] && mailx "${MAILX_ARGS[@]}" -S "from='$EMAIL_FROM'" -s "Backup failure: $RSYNC_SOURCE" "${EMAIL_TO[@]}" <<-EOF Exit code: $ERR Output: $(< "$RSYNC_LOG") diff --git a/dovecot-service-checksuspended b/dovecot-service-checksuspended index cd9181f..2af1775 100755 --- a/dovecot-service-checksuspended +++ b/dovecot-service-checksuspended @@ -1,5 +1,5 @@ #!/bin/bash -# Version: 0.0.1 +# Version: 0.1.0 # Copyright (c) 2023: # Darren 'Tadgy' Austin # Licensed under the terms of the GNU General Public License version 3.