mirror of
https://github.com/myvesta/vesta.git
synced 2024-11-21 04:50:10 -08:00
50 lines
1.3 KiB
Bash
Executable File
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
|