Files
VestaCP/bin/v_restart_web
2012-02-19 00:27:24 +02:00

72 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# info: restart dns service
# options: none
#
# The function tells BIND service to reload dns zone files.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Importing variables
source $VESTA/conf/vars.conf
source $V_CONF/vesta.conf
# Restart functions
apache() {
/etc/init.d/httpd status >/dev/null 2>&1
if [ $? -eq 0 ]; then
/etc/init.d/httpd graceful >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$E_RESTART $1"
exit $E_RESTART
fi
else
/etc/init.d/httpd start >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$E_RESTART $1"
exit $E_RESTART
fi
fi
}
nginx() {
/etc/init.d/nginx status >/dev/null 2>&1
if [ $? -eq 0 ]; then
/etc/init.d/nginx reload >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$E_RESTART $1"
exit $E_RESTART
fi
else
/etc/init.d/nginx start >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$E_RESTART $1"
exit $E_RESTART
fi
fi
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Checking system
if [ "$WEB_SYSTEM" = 'apache' ]; then
apache $1
fi
if [ "$PROXY_SYSTEM" = 'nginx' ]; then
nginx $1
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
exit