fix: correct shellcheck issues

This commit is contained in:
Alex Kelly 2023-01-16 19:26:57 -05:00
parent f20625d391
commit 4d544d0b3e

View file

@ -41,7 +41,7 @@ run_backup () {
#Do the backup
${ECHO} "Starting backup on $HOST at $STARTTIME"
${RESTIC} backup \
--tag $BACKUP_TAG \
--tag "$BACKUP_TAG" \
--exclude-file $BACKUP_EXCLUDES \
$BACKUP_PATHS
return $?
@ -51,7 +51,7 @@ run_forget (){
# Remove old Backups
${ECHO} "Removing old backups per retention settings"
${RESTIC} forget \
--tag $BACKUP_TAG \
--tag "$BACKUP_TAG" \
--prune \
--keep-daily $RETENTION_DAYS \
--keep-weekly $RETENTION_WEEKS \
@ -72,7 +72,7 @@ cleanup () {
${ECHO} "Removing lockfile"
${RESTIC} unlock
${ECHO} "Removing logs ($LOG_DIR/$LOG_BASE-*) older than $LOG_KEEP days"
${FIND} $LOG_DIR -name $LOG_BASE-* -mtime +$LOG_KEEP
${FIND} "$LOG_DIR" -name "$LOG_BASE-*" -mtime +$LOG_KEEP
}
send_matrix () {
@ -88,7 +88,7 @@ notify () {
# echo "text to send" | notify
local message=$1
if [ -z "$message" ]; then
read message
read -r message
fi
# call whatever notification script/function you wish with "$message" as the part you want to show
@ -102,7 +102,7 @@ if run_backup && restic unlock && run_forget && cleanup; then
ENDTIME=$(date "+%Y-%m-%d %H:%M:%S")
#status_total=$(( check_status + backup_status + forget_status ))
#if (( status_total == 0 ));then
${ECHO} "Backup on $HOST completed successfully at $ENDTIME" | ${TEE} -a $LOG_FILE >(notify)
${ECHO} "Backup on $HOST completed successfully at $ENDTIME" | ${TEE} -a "$LOG_FILE" >(notify)
else
${ECHO} "Backup on $HOST completed at $ENDTIME with issues (see $LOG_FILE)" | ${TEE} -a $LOG_FILE >(notify)
${ECHO} "Backup on $HOST completed at $ENDTIME with issues (see $LOG_FILE)" | ${TEE} -a "$LOG_FILE" >(notify)
fi