mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 02:28:03 -07:00
send email if restart failed
This commit is contained in:
parent
d430f146ab
commit
44d78bbef6
7 changed files with 92 additions and 1 deletions
|
@ -34,6 +34,19 @@ if [ ! -z "$CRON_SYSTEM" ]; then
|
|||
if [ $? -ne 0 ]; then
|
||||
/etc/init.d/$CRON_SYSTEM restart >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ -e "$VESTA/web/inc/mail-wrapper.php" ]; then
|
||||
send_mail="$VESTA/web/inc/mail-wrapper.php"
|
||||
else
|
||||
send_mail=$(which mail)
|
||||
fi
|
||||
email=$(grep CONTACT $VESTA/data/users/admin/user.conf)
|
||||
email=$(echo "$email" | cut -f 2 -d "'")
|
||||
tmpfile=$(mktemp)
|
||||
subj="$(hostname): $CRON_SYSTEM restart failed"
|
||||
/etc/init.d/$CRON_SYSTEM configtest >> $tmpfile 2>&1
|
||||
/etc/init.d/$CRON_SYSTEM restart >> $tmpfile 2>&1
|
||||
cat $tmpfile | $send_mail -s "$subj" $email
|
||||
rm -f $tmpfile
|
||||
exit $E_RESTART
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -34,6 +34,19 @@ if [ ! -z "$DNS_SYSTEM" ]; then
|
|||
if [ $? -ne 0 ]; then
|
||||
/etc/init.d/$DNS_SYSTEM restart >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ -e "$VESTA/web/inc/mail-wrapper.php" ]; then
|
||||
send_mail="$VESTA/web/inc/mail-wrapper.php"
|
||||
else
|
||||
send_mail=$(which mail)
|
||||
fi
|
||||
email=$(grep CONTACT $VESTA/data/users/admin/user.conf)
|
||||
email=$(echo "$email" | cut -f 2 -d "'")
|
||||
tmpfile=$(mktemp)
|
||||
subj="$(hostname): $DNS_SYSTEM restart failed"
|
||||
/etc/init.d/$DNS_SYSTEM configtest >> $tmpfile 2>&1
|
||||
/etc/init.d/$DNS_SYSTEM restart >> $tmpfile 2>&1
|
||||
cat $tmpfile | $send_mail -s "$subj" $email
|
||||
rm -f $tmpfile
|
||||
exit $E_RESTART
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -34,6 +34,19 @@ if [ ! -z "$FTP_SYSTEM" ]; then
|
|||
if [ $? -ne 0 ]; then
|
||||
/etc/init.d/$FTP_SYSTEM restart >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ -e "$VESTA/web/inc/mail-wrapper.php" ]; then
|
||||
send_mail="$VESTA/web/inc/mail-wrapper.php"
|
||||
else
|
||||
send_mail=$(which mail)
|
||||
fi
|
||||
email=$(grep CONTACT $VESTA/data/users/admin/user.conf)
|
||||
email=$(echo "$email" | cut -f 2 -d "'")
|
||||
tmpfile=$(mktemp)
|
||||
subj="$(hostname): $FTP_SYSTEM restart failed"
|
||||
/etc/init.d/$FTP_SYSTEM configtest >> $tmpfile 2>&1
|
||||
/etc/init.d/$FTP_SYSTEM restart >> $tmpfile 2>&1
|
||||
cat $tmpfile | $send_mail -s "$subj" $email
|
||||
rm -f $tmpfile
|
||||
exit $E_RESTART
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -34,6 +34,19 @@ if [ ! -z "$MAIL_SYSTEM" ]; then
|
|||
if [ $? -ne 0 ]; then
|
||||
/etc/init.d/$MAIL_SYSTEM restart >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ -e "$VESTA/web/inc/mail-wrapper.php" ]; then
|
||||
send_mail="$VESTA/web/inc/mail-wrapper.php"
|
||||
else
|
||||
send_mail=$(which mail)
|
||||
fi
|
||||
email=$(grep CONTACT $VESTA/data/users/admin/user.conf)
|
||||
email=$(echo "$email" | cut -f 2 -d "'")
|
||||
tmpfile=$(mktemp)
|
||||
subj="$(hostname): $MAIL_SYSTEM restart failed"
|
||||
/etc/init.d/$MAIL_SYSTEM configtest >> $tmpfile 2>&1
|
||||
/etc/init.d/$MAIL_SYSTEM restart >> $tmpfile 2>&1
|
||||
cat $tmpfile | $send_mail -s "$subj" $email
|
||||
rm -f $tmpfile
|
||||
exit $E_RESTART
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -34,6 +34,19 @@ if [ ! -z "$PROXY_SYSTEM" ]; then
|
|||
if [ $? -ne 0 ]; then
|
||||
/etc/init.d/$PROXY_SYSTEM restart >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ -e "$VESTA/web/inc/mail-wrapper.php" ]; then
|
||||
send_mail="$VESTA/web/inc/mail-wrapper.php"
|
||||
else
|
||||
send_mail=$(which mail)
|
||||
fi
|
||||
email=$(grep CONTACT $VESTA/data/users/admin/user.conf)
|
||||
email=$(echo "$email" | cut -f 2 -d "'")
|
||||
tmpfile=$(mktemp)
|
||||
subj="$(hostname): $PROXY_SYSTEM restart failed"
|
||||
/etc/init.d/$PROXY_SYSTEM configtest >> $tmpfile 2>&1
|
||||
/etc/init.d/$PROXY_SYSTEM restart >> $tmpfile 2>&1
|
||||
cat $tmpfile | $send_mail -s "$subj" $email
|
||||
rm -f $tmpfile
|
||||
exit $E_RESTART
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -30,6 +30,19 @@ check_args '1' "$#" 'SERVICE'
|
|||
if [ -x "/etc/init.d/$service" ]; then
|
||||
/etc/init.d/$service restart >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ -e "$VESTA/web/inc/mail-wrapper.php" ]; then
|
||||
send_mail="$VESTA/web/inc/mail-wrapper.php"
|
||||
else
|
||||
send_mail=$(which mail)
|
||||
fi
|
||||
email=$(grep CONTACT $VESTA/data/users/admin/user.conf)
|
||||
email=$(echo "$email" | cut -f 2 -d "'")
|
||||
tmpfile=$(mktemp)
|
||||
subj="$(hostname): $service restart failed"
|
||||
/etc/init.d/$service configtest >> $tmpfile 2>&1
|
||||
/etc/init.d/$service restart >> $tmpfile 2>&1
|
||||
cat $tmpfile | $send_mail -s "$subj" $email
|
||||
rm -f $tmpfile
|
||||
exit $E_RESTART
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -31,9 +31,22 @@ fi
|
|||
# Restart system
|
||||
if [ ! -z "$WEB_SYSTEM" ]; then
|
||||
/etc/init.d/$WEB_SYSTEM reload >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ "$?" -ne 0 ]; then
|
||||
/etc/init.d/$WEB_SYSTEM restart >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ -e "$VESTA/web/inc/mail-wrapper.php" ]; then
|
||||
send_mail="$VESTA/web/inc/mail-wrapper.php"
|
||||
else
|
||||
send_mail=$(which mail)
|
||||
fi
|
||||
email=$(grep CONTACT $VESTA/data/users/admin/user.conf)
|
||||
email=$(echo "$email" | cut -f 2 -d "'")
|
||||
tmpfile=$(mktemp)
|
||||
subj="$(hostname): $WEB_SYSTEM restart failed"
|
||||
/etc/init.d/$WEB_SYSTEM configtest >> $tmpfile 2>&1
|
||||
/etc/init.d/$WEB_SYSTEM restart >> $tmpfile 2>&1
|
||||
cat $tmpfile | $send_mail -s "$subj" $email
|
||||
rm -f $tmpfile
|
||||
exit $E_RESTART
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue