File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1111
1212# Argument definition
1313service=$1
14- force =$2
14+ restart =$2
1515
1616# Includes
1717source $HESTIA /func/main.sh
@@ -23,6 +23,7 @@ PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
2323# ----------------------------------------------------------#
2424
2525check_args ' 1' " $# " ' SERVICE'
26+ is_format_valid ' service' ' restart'
2627
2728# ----------------------------------------------------------#
2829# Action #
@@ -32,7 +33,7 @@ if [ "$service" = "iptables" ]; then
3233 # Run the restart rules for iptables firewall
3334 $BIN /v-stop-firewall
3435 $BIN /v-update-firewall
35- elif [ -z " $force " -o " $force " = " no" ] && [ \
36+ elif [ -z " $restart " -o " $restart " = " no" ] && [ \
3637 " $service " = " nginx" -o \
3738 " $service " = " apache2" -o \
3839 " $service " = " exim4" -o \
@@ -64,4 +65,7 @@ if [ $? -ne 0 ]; then
6465 log_history " Restart of $service failed."
6566fi
6667
68+ # Logging
69+ log_event " $OK " " $ARGUMENTS "
70+
6771exit
Original file line number Diff line number Diff line change @@ -836,6 +836,14 @@ is_format_valid_shell() {
836836 exit $E_INVALID
837837 fi
838838}
839+
840+ # Service name validator
841+ is_service_format_valid () {
842+ if ! [[ " $1 " =~ ^[[:alnum:]][-| \. | _[:alnum:]]{0,64}$ ]]; then
843+ check_result $E_INVALID " invalid $2 format :: $1 "
844+ fi
845+ }
846+
839847# Format validation controller
840848is_format_valid () {
841849 for arg_name in $* ; do
@@ -902,6 +910,7 @@ is_format_valid() {
902910 restart) is_boolean_format_valid " $arg " ' restart' ;;
903911 rtype) is_dns_type_format_valid " $arg " ;;
904912 rule) is_int_format_valid " $arg " " rule id" ;;
913+ service) is_service_format_valid " $arg " " $arg_name " ;;
905914 soa) is_domain_format_valid " $arg " ' SOA' ;;
906915 # missing command: is_format_valid_shell
907916 shell) is_format_valid_shell " $arg " ;;
You can’t perform that action at this time.
0 commit comments