diff --git a/bin/v-backup-user b/bin/v-backup-user index edd20e91..37a6edd2 100755 --- a/bin/v-backup-user +++ b/bin/v-backup-user @@ -53,7 +53,11 @@ else subj="$user → backup failed" email=$(grep CONTACT $VESTA/data/users/admin/user.conf | cut -f 2 -d \') fi -send_mail="$VESTA/web/inc/mail-wrapper.php" +if [ -e "$VESTA/web/inc/mail-wrapper.php" ]; then + send_mail="$VESTA/web/inc/mail-wrapper.php" +else + send_mail=$(which mail) +fi # Check load average la=$(cat /proc/loadavg | cut -f 1 -d ' ' | cut -f 1 -d '.') diff --git a/bin/v-restart-cron b/bin/v-restart-cron index 8bb317b4..87223111 100755 --- a/bin/v-restart-cron +++ b/bin/v-restart-cron @@ -34,7 +34,11 @@ if [ ! -z "$CRON_SYSTEM" ]; then if [ $? -ne 0 ]; then /etc/init.d/$CRON_SYSTEM restart >/dev/null 2>&1 if [ $? -ne 0 ]; then - send_mail="$VESTA/web/inc/mail-wrapper.php" + 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) diff --git a/bin/v-restart-ftp b/bin/v-restart-ftp index 0f0bc6d5..da106347 100755 --- a/bin/v-restart-ftp +++ b/bin/v-restart-ftp @@ -34,7 +34,11 @@ if [ ! -z "$FTP_SYSTEM" ]; then if [ $? -ne 0 ]; then /etc/init.d/$FTP_SYSTEM restart >/dev/null 2>&1 if [ $? -ne 0 ]; then - send_mail="$VESTA/web/inc/mail-wrapper.php" + 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) diff --git a/bin/v-restart-mail b/bin/v-restart-mail index b7bba97c..4afcd469 100755 --- a/bin/v-restart-mail +++ b/bin/v-restart-mail @@ -34,7 +34,11 @@ if [ ! -z "$MAIL_SYSTEM" ]; then if [ $? -ne 0 ]; then /etc/init.d/$MAIL_SYSTEM restart >/dev/null 2>&1 if [ $? -ne 0 ]; then - send_mail="$VESTA/web/inc/mail-wrapper.php" + 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) diff --git a/bin/v-restart-proxy b/bin/v-restart-proxy index ad269e3c..67e12cf7 100755 --- a/bin/v-restart-proxy +++ b/bin/v-restart-proxy @@ -34,7 +34,11 @@ if [ ! -z "$PROXY_SYSTEM" ]; then if [ $? -ne 0 ]; then /etc/init.d/$PROXY_SYSTEM restart >/dev/null 2>&1 if [ $? -ne 0 ]; then - send_mail="$VESTA/web/inc/mail-wrapper.php" + 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) diff --git a/bin/v-restart-service b/bin/v-restart-service index b15cfaa2..dfffab6b 100755 --- a/bin/v-restart-service +++ b/bin/v-restart-service @@ -30,7 +30,11 @@ check_args '1' "$#" 'SERVICE' if [ -x "/etc/init.d/$service" ]; then /etc/init.d/$service restart >/dev/null 2>&1 if [ $? -ne 0 ]; then - send_mail="$VESTA/web/inc/mail-wrapper.php" + 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) diff --git a/bin/v-restart-web b/bin/v-restart-web index 27e734f9..28bb73e0 100755 --- a/bin/v-restart-web +++ b/bin/v-restart-web @@ -34,7 +34,11 @@ if [ ! -z "$WEB_SYSTEM" ]; then if [ "$?" -ne 0 ]; then /etc/init.d/$WEB_SYSTEM restart >/dev/null 2>&1 if [ $? -ne 0 ]; then - send_mail="$VESTA/web/inc/mail-wrapper.php" + 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) diff --git a/bin/v-restore-user b/bin/v-restore-user index c6e3ec9f..acf93489 100755 --- a/bin/v-restore-user +++ b/bin/v-restore-user @@ -62,7 +62,12 @@ is_backup_available #----------------------------------------------------------# # Define email wrapper -send_mail="$VESTA/web/inc/mail-wrapper.php" +if [ -e "$VESTA/web/inc/mail-wrapper.php" ]; then + send_mail="$VESTA/web/inc/mail-wrapper.php" +else + send_mail=$(which mail) +fi + # Check user check_user=$(is_object_valid 'user' 'USER' "$user")