Fix mailadress and subject

This commit is contained in:
ikheetjeff 2024-05-05 20:28:05 +02:00 committed by GitHub
parent dcd0bf2d64
commit 66ae5580cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,6 +29,9 @@ mysql_connect() {
mysql --defaults-file=$mycnf -e 'SELECT VERSION()' > $mysql_out 2>&1
if [ '0' -ne "$?" ]; then
if [ "$notify" != 'no' ]; then
subj="Error: Connection to $HOST failed"
email=$($BIN/v-get-user-value admin CONTACT)
echo -e "Can't connect to MySQL $HOST\n$(cat $mysql_out)" |\
$SENDMAIL -s "$subj" $email
fi
@ -59,6 +62,9 @@ mysql_dump() {
if [ '0' -ne "$?" ]; then
rm -rf $tmpdir
if [ "$notify" != 'no' ]; then
subj="Error: dump $database failed"
email=$($BIN/v-get-user-value admin CONTACT)
echo -e "Can't dump database $database\n$(cat $err)" |\
$SENDMAIL -s "$subj" $email
fi
@ -82,6 +88,9 @@ psql_connect() {
psql -h $HOST -U $USER -c "SELECT VERSION()" > /dev/null 2>/tmp/e.psql
if [ '0' -ne "$?" ]; then
if [ "$notify" != 'no' ]; then
subj="Error: Connection to $HOST failed"
email=$($BIN/v-get-user-value admin CONTACT)
echo -e "Can't connect to PostgreSQL $HOST\n$(cat /tmp/e.psql)" |\
$SENDMAIL -s "$subj" $email
fi
@ -103,6 +112,9 @@ psql_dump() {
if [ '0' -ne "$?" ]; then
rm -rf $tmpdir
if [ "$notify" != 'no' ]; then
subj="Error: dump $database failed"
email=$($BIN/v-get-user-value admin CONTACT)
echo -e "Can't dump database $database\n$(cat /tmp/e.psql)" |\
$SENDMAIL -s "$subj" $email
fi