feat: enable feature flag for notifications
default to not sending notifications, override in the env
This commit is contained in:
		
					parent
					
						
							
								f509e68ef5
							
						
					
				
			
			
				commit
				
					
						32409b9891
					
				
			
		
					 2 changed files with 9 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -10,6 +10,7 @@ BACKUP_EXCLUDES="/etc/restic/exclude"
 | 
			
		|||
 | 
			
		||||
BACKUP_TAG=$(hostname -s)
 | 
			
		||||
 | 
			
		||||
FEAT_NOTIFY=false
 | 
			
		||||
 | 
			
		||||
# How many backups to keep.
 | 
			
		||||
RETENTION_DAYS=7
 | 
			
		||||
| 
						 | 
				
			
			@ -96,12 +97,16 @@ notify () {
 | 
			
		|||
	fi
 | 
			
		||||
	
 | 
			
		||||
	# call whatever notification script/function you wish with "$message" as the part you want to show
 | 
			
		||||
	send_matrix "$message"
 | 
			
		||||
    if $FEAT_NOTIFY; then
 | 
			
		||||
        send_matrix "$message"
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Do the actual work
 | 
			
		||||
ERRORS=""
 | 
			
		||||
STATUS_TOTAL=0
 | 
			
		||||
echo "testing"|notify
 | 
			
		||||
exit 1
 | 
			
		||||
 | 
			
		||||
if run_checklock; then
 | 
			
		||||
	${ECHO} "Restic backup on $HOST starting at $(timestamp)"|notify
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										3
									
								
								etc/env
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								etc/env
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -9,6 +9,9 @@ export RESTIC_REPOSITORY=
 | 
			
		|||
# restic cache dir
 | 
			
		||||
export RESTIC_CACHE_DIR=
 | 
			
		||||
 | 
			
		||||
# Uncomment the next line to ENABLE notifications
 | 
			
		||||
#export FEAT_NOTIFY=true
 | 
			
		||||
 | 
			
		||||
## matrix notifiction hook settings
 | 
			
		||||
# base url for matrix hook
 | 
			
		||||
export MATRIX_HOOK_URL=
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue