vesta/bin/v-restart-service

50 lines
1.3 KiB
Plaintext
Raw Normal View History

2013-01-19 23:07:26 +02:00
#!/bin/bash
# info: restart service
# options: service
#
# The function restarts system service.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
2015-11-06 17:38:58 +02:00
# Argument definition
2013-01-19 23:07:26 +02:00
service=$1
# Includes
source $VESTA/func/main.sh
2016-08-09 17:36:36 +03:00
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
2013-01-19 23:07:26 +02:00
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'SERVICE'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
2014-10-23 17:07:08 +03:00
if [ "$service" != "iptables" ]; then
service $service restart >/dev/null 2>&1
if [ $? -ne 0 ]; then
check_result $E_RESTART "$service restart failed"
2014-10-23 17:07:08 +03:00
fi
else
$BIN/v-stop-firewall
$BIN/v-update-firewall
if [ $? -ne 0 ]; then
check_result $E_RESTART "$service restart failed"
2014-10-23 17:07:08 +03:00
fi
2013-01-19 23:07:26 +02:00
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit