forked from CopterSicht/Restic-Backend-Watchdog
		
	backup dir stored in variable; eMail settings in variable
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
			
		||||
 
 | 
			
		||||
backups
 | 
			
		||||
@ -2,16 +2,21 @@
 | 
			
		||||
 | 
			
		||||
### GENERAL SETTINGS ###
 | 
			
		||||
DEBUG="true"
 | 
			
		||||
timestampFolder="index"
 | 
			
		||||
timestampFolder="index" #folder for reading timestamp
 | 
			
		||||
backupFolder="./backups" #directory that contains all repos
 | 
			
		||||
########################
 | 
			
		||||
###     eMail        ###
 | 
			
		||||
receiverEmail="admin@coptersicht.de"
 | 
			
		||||
senderEmail="autobackupwatchdog@coptersicht.de"
 | 
			
		||||
senderName="AutoBackup Watchdog"
 | 
			
		||||
########################
 | 
			
		||||
 | 
			
		||||
######### REPO SETTINGS #########
 | 
			
		||||
 | 
			
		||||
#repos_name[0]=" first backup repo"
 | 
			
		||||
#repos_directory[0]="first_repo"
 | 
			
		||||
#repos_interval[0]=21600 #sec
 | 
			
		||||
#repos_interval_tolerance[0]=10 #%
 | 
			
		||||
repos_name[0]=" first backup repo"
 | 
			
		||||
repos_directory[0]="first_repo"
 | 
			
		||||
repos_interval[0]=21600 #sec
 | 
			
		||||
repos_interval_tolerance[0]=10 #%
 | 
			
		||||
 | 
			
		||||
#repos_name[1]="second backup repo"
 | 
			
		||||
#repos_directory[1]="second_repo"
 | 
			
		||||
@ -31,6 +36,8 @@ fn_result="$(echo $(($1/86400))d $(($(($1 - $1/86400*86400))/3600))h:$(($(($1 -
 | 
			
		||||
echo "Starting AutoBackup Watchdog"
 | 
			
		||||
echo "Local time: $(date)"
 | 
			
		||||
 | 
			
		||||
cd $backupFolder #jump to backup folder that contains the repos
 | 
			
		||||
 | 
			
		||||
repo_count=$(("${#repos_name[@]}"))
 | 
			
		||||
echo "Repo Count: $repo_count"
 | 
			
		||||
repo_count=$(($repo_count-1))
 | 
			
		||||
@ -60,7 +67,7 @@ do
 | 
			
		||||
        rm -f mail_content.txt
 | 
			
		||||
        cat >> mail_content.txt <<EOL
 | 
			
		||||
Subject: AutoBackup Failure "${repos_name[i]}"
 | 
			
		||||
From: autobackupwatchdog@coptersicht.de
 | 
			
		||||
From: $senderEmail
 | 
			
		||||
Content-Type: text/html; charset="utf8
 | 
			
		||||
<head>
 | 
			
		||||
    <style>
 | 
			
		||||
@ -105,7 +112,7 @@ Content-Type: text/html; charset="utf8
 | 
			
		||||
EOL
 | 
			
		||||
        if [ "$DEBUG" = "false" ];
 | 
			
		||||
        then 
 | 
			
		||||
            ssmtp -f"autobackupwatchdog@coptersicht.de" -F"AutoBackup Watchdog" $receiverEmail < mail_content.txt
 | 
			
		||||
            ssmtp -f$senderEmail -F$senderName $receiverEmail < mail_content.txt
 | 
			
		||||
            rm mail_content.txt
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user