Skip to content

Commit 905a4af

Browse files
author
Kristan Kenney
authored
Merge pull request hestiacp#1765 from jaapmarcus/fix/mysql-pgsql-connect
Mysql connection failure send to nobody
2 parents 118477c + 9eddc62 commit 905a4af

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

func/db.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ mysql_connect() {
6060
mysql --defaults-file=$mycnf -e 'SELECT VERSION()' > $mysql_out 2>&1
6161
if [ '0' -ne "$?" ]; then
6262
if [ "$notify" != 'no' ]; then
63+
email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
6364
echo -e "Can't connect to MySQL $HOST\n$(cat $mysql_out)" |\
6465
$SENDMAIL -s "$subj" $email
6566
fi
@@ -90,6 +91,7 @@ mysql_dump() {
9091
if [ '0' -ne "$?" ]; then
9192
rm -rf $tmpdir
9293
if [ "$notify" != 'no' ]; then
94+
email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
9395
echo -e "Can't dump database $database\n$(cat $err)" |\
9496
$SENDMAIL -s "$subj" $email
9597
fi
@@ -115,6 +117,7 @@ psql_connect() {
115117
psql -h $HOST -U $USER -p $PORT -c "SELECT VERSION()" > /dev/null 2>/tmp/e.psql
116118
if [ '0' -ne "$?" ]; then
117119
if [ "$notify" != 'no' ]; then
120+
email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
118121
echo -e "Can't connect to PostgreSQL $HOST\n$(cat /tmp/e.psql)" |\
119122
$SENDMAIL -s "$subj" $email
120123
fi
@@ -136,6 +139,7 @@ psql_dump() {
136139
if [ '0' -ne "$?" ]; then
137140
rm -rf $tmpdir
138141
if [ "$notify" != 'no' ]; then
142+
email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
139143
echo -e "Can't dump database $database\n$(cat /tmp/e.psql)" |\
140144
$SENDMAIL -s "$subj" $email
141145
fi

0 commit comments

Comments
 (0)