Skip to content

Commit 596f025

Browse files
authored
show database server port in notification email
Running multiple database servers on same host theres no indication which went down if only port differs. This change adds the port number to the notification email so it is easier to see which database server went down.
1 parent 6e0443a commit 596f025

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

func/db.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ mysql_connect() {
7474
if [ "$notify" != 'no' ]; then
7575
email=$(grep CONTACT "$HESTIA/data/users/$ROOT_USER/user.conf" | cut -f 2 -d \')
7676
subj="MySQL connection error on $(hostname)"
77-
echo -e "Can't connect to MySQL $HOST\n$(cat $mysql_out)" \
77+
echo -e "Can't connect to MySQL $HOST:$PORT\n$(cat $mysql_out)" \
7878
| $SENDMAIL -s "$subj" $email
7979
fi
8080
rm -f $mysql_out
@@ -147,7 +147,7 @@ psql_connect() {
147147
if [ "$notify" != 'no' ]; then
148148
email=$(grep CONTACT "$HESTIA/data/users/$ROOT_USER/user.conf" | cut -f 2 -d \')
149149
subj="PostgreSQL connection error on $(hostname)"
150-
echo -e "Can't connect to PostgreSQL $HOST\n$(cat /tmp/e.psql)" \
150+
echo -e "Can't connect to PostgreSQL $HOST:$PORT\n$(cat /tmp/e.psql)" \
151151
| $SENDMAIL -s "$subj" $email
152152
fi
153153
echo "Error: Connection to $HOST failed"

0 commit comments

Comments
 (0)