diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index 53fe16480..26411e381 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -407,11 +407,16 @@ set_version() { systemctl_func() { local action=$1 + local echo_action=$1 local service_name=$2 + if [[ "$echo_action" == "stop" ]]; then + $echo_action = "stopp" + fi + echo "" - echo "${action^}ing $service_name service at $(date +"%T.%6N")" - systemctl $action $service_name + echo "${echo_action^}ing $service_name service at $(date +"%T.%6N")" + systemctl $action $service_name && echo "Successfully ${echo_action}ed $service_name." || echo "Failed to $action $service_name." echo "" } diff --git a/salt/common/tools/sbin/soup b/salt/common/tools/sbin/soup index 5c15ea453..9c2379a8c 100755 --- a/salt/common/tools/sbin/soup +++ b/salt/common/tools/sbin/soup @@ -92,6 +92,10 @@ check_err() { if [[ $exit_code -ge 64 && $exit_code -le 113 ]]; then echo "$err_msg" fi + set +e + systemctl_func "start" "$cron_service_name" + echo "Ensuring highstate is enabled." + salt-call state.enable highstate --local exit $exit_code fi @@ -954,7 +958,7 @@ fix_wazuh() { } main() { - trap 'trap_exit_code=$?; systemctl_func "start" "$cron_service_name"; salt-call state.enable highstate -l info --local; check_err $trap_exit_code' EXIT + trap 'check_err $?' EXIT if [ -n "$BRANCH" ]; then echo "SOUP will use the $BRANCH branch."