diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index eef0f6d8..b457e8b4 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -23,12 +23,18 @@ unset IFS case "$1" in service) + containsElement "${2}" "${NODE_SERVICES[@]}" + if [[ "start,stop,restart" == *"${3}"* ]]; then + echo -e "${idsCL[Red]}(${3}) is not an allowed service action.${idsCL[Default]}" + exit 1 + fi if [ "$2" = "mysql" ]; then SER='MySQL' elif [ "$2" = "nginx" ]; then SER='NGINX' elif [ "$2" = "gogs" ]; then SER='Gogs' elif [ "$2" = "haproxy" ]; then SER='HAProxy' elif [ "$2" = "keepalived" ]; then SER='Keepalived' elif [ "$2" = "maxscale" ]; then SER='MaxScale' + else SER="${2}" fi if [ "$3" = "stop" ]; then ADISP='Stopp'; else ADISP="$(tr '[:lower:]' '[:upper:]' <<< ${3:0:1})${3:1}"; fi if [ "$3" = "start" ] && [ "$2" = "haproxy" ]; then TACT='restart'; else TACT="${3}"; fi