Просмотр исходного кода

Mysql connection failure send to nobody

$email var was not always been set in mysql_connect, mysql_dump functions  (Also aplies to pgsql)
Jaap Marcus 4 лет назад
Родитель
Сommit
9eddc62359
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      func/db.sh

+ 4 - 0
func/db.sh

@@ -60,6 +60,7 @@ mysql_connect() {
     mysql --defaults-file=$mycnf -e 'SELECT VERSION()' > $mysql_out 2>&1
     if [ '0' -ne "$?" ]; then
         if [ "$notify" != 'no' ]; then
+            email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
             echo -e "Can't connect to MySQL $HOST\n$(cat $mysql_out)" |\
                 $SENDMAIL -s "$subj" $email
         fi
@@ -90,6 +91,7 @@ mysql_dump() {
     if [ '0' -ne "$?" ]; then
         rm -rf $tmpdir
         if [ "$notify" != 'no' ]; then
+            email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
             echo -e "Can't dump database $database\n$(cat $err)" |\
                 $SENDMAIL -s "$subj" $email
         fi
@@ -115,6 +117,7 @@ psql_connect() {
     psql -h $HOST -U $USER -p $PORT -c "SELECT VERSION()" > /dev/null 2>/tmp/e.psql
     if [ '0' -ne "$?" ]; then
         if [ "$notify" != 'no' ]; then
+            email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
             echo -e "Can't connect to PostgreSQL $HOST\n$(cat /tmp/e.psql)" |\
                 $SENDMAIL -s "$subj" $email
         fi
@@ -136,6 +139,7 @@ psql_dump() {
     if [ '0' -ne "$?" ]; then
         rm -rf $tmpdir
         if [ "$notify" != 'no' ]; then
+            email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
             echo -e "Can't dump database $database\n$(cat /tmp/e.psql)" |\
                 $SENDMAIL -s "$subj" $email
         fi