myvesta/bin/v-restart-service
2016-06-24 16:31:43 +03:00

49 lines
1.2 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
#----------------------------------------------------------#
# 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