fix: correct shellcheck issues
This commit is contained in:
parent
f20625d391
commit
4d544d0b3e
1 changed files with 6 additions and 6 deletions
12
backup.sh
12
backup.sh
|
@ -41,7 +41,7 @@ run_backup () {
|
||||||
#Do the backup
|
#Do the backup
|
||||||
${ECHO} "Starting backup on $HOST at $STARTTIME"
|
${ECHO} "Starting backup on $HOST at $STARTTIME"
|
||||||
${RESTIC} backup \
|
${RESTIC} backup \
|
||||||
--tag $BACKUP_TAG \
|
--tag "$BACKUP_TAG" \
|
||||||
--exclude-file $BACKUP_EXCLUDES \
|
--exclude-file $BACKUP_EXCLUDES \
|
||||||
$BACKUP_PATHS
|
$BACKUP_PATHS
|
||||||
return $?
|
return $?
|
||||||
|
@ -51,7 +51,7 @@ run_forget (){
|
||||||
# Remove old Backups
|
# Remove old Backups
|
||||||
${ECHO} "Removing old backups per retention settings"
|
${ECHO} "Removing old backups per retention settings"
|
||||||
${RESTIC} forget \
|
${RESTIC} forget \
|
||||||
--tag $BACKUP_TAG \
|
--tag "$BACKUP_TAG" \
|
||||||
--prune \
|
--prune \
|
||||||
--keep-daily $RETENTION_DAYS \
|
--keep-daily $RETENTION_DAYS \
|
||||||
--keep-weekly $RETENTION_WEEKS \
|
--keep-weekly $RETENTION_WEEKS \
|
||||||
|
@ -72,7 +72,7 @@ cleanup () {
|
||||||
${ECHO} "Removing lockfile"
|
${ECHO} "Removing lockfile"
|
||||||
${RESTIC} unlock
|
${RESTIC} unlock
|
||||||
${ECHO} "Removing logs ($LOG_DIR/$LOG_BASE-*) older than $LOG_KEEP days"
|
${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 () {
|
send_matrix () {
|
||||||
|
@ -88,7 +88,7 @@ notify () {
|
||||||
# echo "text to send" | notify
|
# echo "text to send" | notify
|
||||||
local message=$1
|
local message=$1
|
||||||
if [ -z "$message" ]; then
|
if [ -z "$message" ]; then
|
||||||
read message
|
read -r message
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# call whatever notification script/function you wish with "$message" as the part you want to show
|
# 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")
|
ENDTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||||
#status_total=$(( check_status + backup_status + forget_status ))
|
#status_total=$(( check_status + backup_status + forget_status ))
|
||||||
#if (( status_total == 0 ));then
|
#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
|
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
|
fi
|
||||||
|
|
Loading…
Reference in a new issue