mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 18:49:17 -07:00
refactoring: log_event(), is_format_valid()
This commit is contained in:
parent
325ca65f32
commit
a61a6e979e
52 changed files with 582 additions and 1170 deletions
|
@ -14,14 +14,13 @@ source $VESTA/func/main.sh
|
|||
source $VESTA/conf/vesta.conf
|
||||
|
||||
send_email_report() {
|
||||
send_mail="$VESTA/web/inc/mail-wrapper.php"
|
||||
email=$(grep CONTACT $VESTA/data/users/admin/user.conf)
|
||||
email=$(echo "$email" | cut -f 2 -d "'")
|
||||
tmpfile=$(mktemp)
|
||||
subj="$(hostname): $WEB_SYSTEM restart failed"
|
||||
service $WEB_SYSTEM configtest >> $tmpfile 2>&1
|
||||
service $WEB_SYSTEM restart >> $tmpfile 2>&1
|
||||
cat $tmpfile | $send_mail -s "$subj" $email
|
||||
cat $tmpfile |$SENDMAIL -s "$subj" $email
|
||||
rm -f $tmpfile
|
||||
}
|
||||
|
||||
|
@ -62,8 +61,7 @@ if [ "$rc" -ne 0 ]; then
|
|||
service $WEB_SYSTEM restart >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
send_email_report
|
||||
echo "Error: $WEB_SYSTEM restart failed"
|
||||
exit $E_RESTART
|
||||
check_result $E_RESTART "$WEB_SYSTEM restart failed"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue