vesta/bin/v-restart-service
2016-08-09 17:36:36 +03:00

50 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# info: restart service
# options: service
#
# The function restarts system service.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
service=$1
# Includes
source $VESTA/func/main.sh
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'SERVICE'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
if [ "$service" != "iptables" ]; then
service $service restart >/dev/null 2>&1
if [ $? -ne 0 ]; then
check_result $E_RESTART "$service restart failed"
fi
else
$BIN/v-stop-firewall
$BIN/v-update-firewall
if [ $? -ne 0 ]; then
check_result $E_RESTART "$service restart failed"
fi
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit