mirror of https://gitlab.com/bashrc2/epicyon
Option to notify by mail
parent
794da93c52
commit
2bc4bdd15e
|
@ -29,6 +29,8 @@
|
|||
PROJECT_NAME=epicyon
|
||||
epicyonInstallDir=/opt/${PROJECT_NAME}
|
||||
|
||||
MY_EMAIL_ADDRESS="username@domain"
|
||||
|
||||
local_domain=$HOSTNAME
|
||||
if [ -f /var/lib/tor/hidden_service_epicyon/hostname ]; then
|
||||
local_domain=$(cat /var/lib/tor/hidden_service_epicyon/hostname)
|
||||
|
@ -111,6 +113,8 @@ function sendNotification {
|
|||
SUBJECT="$2"
|
||||
MESSAGE="$3"
|
||||
|
||||
hasSent=
|
||||
|
||||
if [ -d /etc/prosody ]; then
|
||||
if [ -f /usr/bin/sendxmpp ]; then
|
||||
# generate a random password for a temporary user account
|
||||
|
@ -126,6 +130,7 @@ function sendNotification {
|
|||
kill_sendxmpp_process
|
||||
# send the xmpp notification using the temporary account
|
||||
echo "${MESSAGE}" | /usr/bin/sendxmpp -u notification -p "${notification_user_password}" -j localhost -o ${local_domain} --message-type=headline -n -t -s ${PROJECT_NAME} ${USERNAME}@${local_domain}
|
||||
hasSent=1
|
||||
fi
|
||||
fi
|
||||
# remove the temporary xmpp account
|
||||
|
@ -135,6 +140,14 @@ function sendNotification {
|
|||
|
||||
if [ -d /etc/matrix ]; then
|
||||
matrix_server_message "${USERNAME}" "${USERNAME}" "$MESSAGE"
|
||||
hasSent=1
|
||||
fi
|
||||
|
||||
if [ ! "$hasSent" ]; then
|
||||
if [[ "$MY_EMAIL_ADDRESS" != "username@domain" ]]; then
|
||||
# send to a fixed email address for a single user instance
|
||||
echo "$MESSAGE" | /usr/bin/mail -s "$SUBJECT" "$MY_EMAIL_ADDRESS"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue