changed ssmtp to mailsend
This commit is contained in:
parent
8b31476644
commit
1ad6d2bab1
28
README.md
28
README.md
|
@ -14,7 +14,7 @@ The script monitors the backend of a restic backup. The bash script is executed
|
|||
* no restic authentication needed
|
||||
* multiple repos
|
||||
* individual interval for each repo
|
||||
* custom email server via [ssmtp](https://wiki.debian.org/sSMTP)
|
||||
* custom email server via [mailsend](https://github.com/muquit/mailsend/blob/master/doc/examples.mediawiki)
|
||||
* loud alarm buzzer via [FTDI_simple_alarm](https://git.mosad.xyz/localhorst/FTDI_simple_alarm)
|
||||
|
||||
## Planned Features
|
||||
|
@ -23,22 +23,9 @@ The script monitors the backend of a restic backup. The bash script is executed
|
|||
## Installation
|
||||
#### 1. download the check_AutoBackup.sh
|
||||
#### 2. chmod +x check_AutoBackup.sh
|
||||
#### 3. install ssmtp
|
||||
#### 4. nano /etc/ssmtp/ssmtp.conf
|
||||
#### 3. install mailsend
|
||||
|
||||
```UseSTARTTLS=YES
|
||||
FromLineOverride=YES
|
||||
root=
|
||||
mailhub=mail.yourmailserver.tld:587
|
||||
AuthUser=mailuser@maildomain.tld
|
||||
AuthPass=yourmailuserpassword
|
||||
```
|
||||
#### 5. nano /etc/ssmtp/revaliases
|
||||
```
|
||||
root:mailuser@maildomain.tld:mail.yourmailserver.tld:587
|
||||
```
|
||||
|
||||
#### 6. edit settings in check_AutoBackup.sh
|
||||
#### 4. edit settings in check_AutoBackup.sh
|
||||
|
||||
```
|
||||
DEBUG="true" #true --> dont send email
|
||||
|
@ -47,10 +34,9 @@ backupFolder="./backups" #directory that contains all repos
|
|||
|
||||
receiverEmail="mailuser@maildomain.tld"
|
||||
senderEmail="mailuser@maildomain.tld"
|
||||
senderName="AutoBackup Watchdog"
|
||||
```
|
||||
|
||||
#### 7. edit repo settings in check_AutoBackup.sh
|
||||
#### 5. edit repo settings in check_AutoBackup.sh
|
||||
|
||||
```
|
||||
repos_name[0]=" first backup repo"
|
||||
|
@ -58,10 +44,10 @@ repos_directory[0]="first_repo" #repo in backupFolder
|
|||
repos_interval[0]=21600 #sec
|
||||
repos_interval_tolerance[0]=10 #%
|
||||
```
|
||||
#### 8. install crontab or systemd-timer
|
||||
#### 6. install crontab or systemd-timer
|
||||
|
||||
#### 9. optional install FTDI simple alarm
|
||||
#### 7. optional install FTDI simple alarm
|
||||
|
||||
[FTDI_simple_alarm](https://git.mosad.xyz/localhorst/FTDI_simple_alarm)
|
||||
|
||||
uncomment line 117 in check_AutoBackup.sh
|
||||
uncomment line 167 in check_AutoBackup.sh
|
||||
|
|
|
@ -7,14 +7,13 @@ backupFolder="/mnt/hdd/backups/" #directory that contains all repos
|
|||
########################
|
||||
### eMail ###
|
||||
receiverEmail="localhorst@mosad.xyz"
|
||||
senderEmail="____#@mosad.xyz"
|
||||
senderName="AutoBackupWatchdog" #no spaces
|
||||
senderEmail="______________@mosad.xyz"
|
||||
########################
|
||||
|
||||
######### REPO SETTINGS #########
|
||||
|
||||
repos_name[0]="my home server"
|
||||
repos_directory[0]="homeserver/"
|
||||
repos_name[0]="Name"
|
||||
repos_directory[0]="path"
|
||||
repos_interval[0]=21600 #sec
|
||||
repos_interval_tolerance[0]=10 #%
|
||||
|
||||
|
@ -22,6 +21,7 @@ repos_interval_tolerance[0]=10 #%
|
|||
#repos_directory[1]="another_repo"
|
||||
#repos_interval[1]=21600 #sec
|
||||
#repos_interval_tolerance[1]=10 #%
|
||||
#################################
|
||||
|
||||
#repos_name[2]="another backup repo"
|
||||
#repos_directory[2]="another_repo"
|
||||
|
@ -55,9 +55,6 @@ do
|
|||
echo "Repo ${repos_directory[i]} doesnt exist!"
|
||||
rm -f mail_content.txt
|
||||
cat >> mail_content.txt <<EOL
|
||||
Subject: AutoBackup Failure "${repos_name[i]}"
|
||||
From: $senderEmail
|
||||
Content-Type: text/html; charset="utf8
|
||||
<head>
|
||||
<style>
|
||||
h1{
|
||||
|
@ -91,14 +88,14 @@ Content-Type: text/html; charset="utf8
|
|||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
<p>Version: 0.2.1</p>
|
||||
<p>Version: 0.2.2</p>
|
||||
<p>Author: <a href="mailto:localhorst@mosad.xyz">localhorst@mosad.xyz</a></p>
|
||||
</footer>
|
||||
|
||||
EOL
|
||||
if [ "$DEBUG" = "false" ];
|
||||
then
|
||||
ssmtp -f$senderEmail -F$senderName $receiverEmail < mail_content.txt
|
||||
mailsend -f $senderEmail -t $receiverEmail -sub "AutoBackup Failure ${repos_name[i]}" -smtp mail.emailserver.science -port 587 -starttls -auth -user autobackupwatchdog@mosad.xyz -pass "__PW_DB__" -cs "utf-8" -mime-type "text/html" -msg-body "mail_content.txt"
|
||||
rm mail_content.txt
|
||||
#/etc/init.d/alarm start
|
||||
fi
|
||||
|
@ -122,9 +119,6 @@ EOL
|
|||
echo -e "\e[39m " #reset console color to black
|
||||
rm -f mail_content.txt
|
||||
cat >> mail_content.txt <<EOL
|
||||
Subject: AutoBackup Failure "${repos_name[i]}"
|
||||
From: $senderEmail
|
||||
Content-Type: text/html; charset="utf8"
|
||||
<head>
|
||||
<style>
|
||||
h1{
|
||||
|
@ -161,14 +155,14 @@ Content-Type: text/html; charset="utf8"
|
|||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
<p>Version: 0.2.1</p>
|
||||
<p>Version: 0.2.2</p>
|
||||
<p>Author: <a href="mailto:localhorst@mosad.xyz">localhorst@mosad.xyz</a></p>
|
||||
</footer>
|
||||
|
||||
EOL
|
||||
if [ "$DEBUG" = "false" ];
|
||||
then
|
||||
ssmtp -f$senderEmail -F$senderName $receiverEmail < mail_content.txt
|
||||
mailsend -f $senderEmail -t $receiverEmail -sub "AutoBackup Failure ${repos_name[i]}" -smtp mail.emailserver.science -port 587 -starttls -auth -user autobackupwatchdog@mosad.xyz -pass "__PW_DB__" -cs "utf-8" -mime-type "text/html" -msg-body "mail_content.txt"
|
||||
rm mail_content.txt
|
||||
#/etc/init.d/alarm start
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue