mirror of
https://github.com/myvesta/vesta
synced 2025-07-05 20:41:53 -07:00
Fix mailadress and subject
This commit is contained in:
parent
dcd0bf2d64
commit
66ae5580cd
1 changed files with 12 additions and 0 deletions
12
func/db.sh
12
func/db.sh
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue