mirror of
https://github.com/YunoHost-Apps/borg_ynh.git
synced 2024-09-03 18:16:05 +02:00
Added option to chose when to receive email alerts, on errors only, never or always.
This commit is contained in:
parent
658e255ac5
commit
d26ca69558
3 changed files with 13 additions and 2 deletions
|
@ -73,10 +73,11 @@ fi
|
||||||
# Send mail on backup (partially) failed
|
# Send mail on backup (partially) failed
|
||||||
domain=$(hostname)
|
domain=$(hostname)
|
||||||
repository="$(sudo yunohost app setting ${borg_id} repository)"
|
repository="$(sudo yunohost app setting ${borg_id} repository)"
|
||||||
if [ ! -z "$errors" ]; then
|
mailalert="$(sudo yunohost app setting ${borg_id} mailalert)"
|
||||||
|
if [[ ! -z "$errors" && $mailalert != "never" ]]; then
|
||||||
cat <(echo -e "$errors\n\n\n") "$log_file" "$err_file" | mail -s "[borg] Backup failed from $domain onto $repository" root
|
cat <(echo -e "$errors\n\n\n") "$log_file" "$err_file" | mail -s "[borg] Backup failed from $domain onto $repository" root
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else if [ $mailalert == "always" ]
|
||||||
cat $log_file | mail -s "[borg] Backup succeed from $domain onto $repository" root
|
cat $log_file | mail -s "[borg] Backup succeed from $domain onto $repository" root
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -85,6 +85,15 @@
|
||||||
},
|
},
|
||||||
"example": "Monthly or Weekly or Daily or Hourly or 4:00 or 5,17:00 or Sat --1..7 18:00:00",
|
"example": "Monthly or Weekly or Daily or Hourly or 4:00 or 5,17:00 or Sat --1..7 18:00:00",
|
||||||
"default": "Daily"
|
"default": "Daily"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mailalert",
|
||||||
|
"type": "string",
|
||||||
|
"ask": {
|
||||||
|
"en": "Do you want admin to receive mail notifications on backups ?",
|
||||||
|
"fr": "Souhaitez-vous recevoir des notifications par mail à chaque sauvegarde ?"
|
||||||
|
},
|
||||||
|
"choices": ["always", "errors_only", "never"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ export on_calendar="$(ynh_app_setting_get $app on_calendar)"
|
||||||
export conf="$(ynh_app_setting_get $app conf)"
|
export conf="$(ynh_app_setting_get $app conf)"
|
||||||
export data="$(ynh_app_setting_get $app data)"
|
export data="$(ynh_app_setting_get $app data)"
|
||||||
export apps="$(ynh_app_setting_get $app apps)"
|
export apps="$(ynh_app_setting_get $app apps)"
|
||||||
|
export mailalert="$(ynh_app_setting_get $app mailalert)"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF AN UPGRADE IS NEEDED
|
# CHECK IF AN UPGRADE IS NEEDED
|
||||||
|
|
Loading…
Add table
Reference in a new issue