Skip to content

Commit

Permalink
chore: sleep before restart and restarting services one by one
Browse files Browse the repository at this point in the history
Refs: XRDDEV-2546
  • Loading branch information
justasnortal committed Dec 15, 2023
1 parent 1a00b0a commit c231b21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/packages/src/xroad/redhat/SPECS/xroad-base.spec
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ fi
fi

%define restart_xroad_services() \
services_to_restart=$(find %{_localstatedir}/lib/rpm-state -type f -name "active" -exec dirname {} \\; | xargs -I {} basename {} | grep xroad- | tr '\\n' ' ') \
services_to_restart=$(find %{_localstatedir}/lib/rpm-state -type f -name "active" -exec dirname {} \\; | xargs -I {} basename {} | grep xroad- | tr '\\n' ' ') \
if [ -n "$services_to_restart" ]; then \
echo "Restarting services: $services_to_restart" \
systemctl --quiet restart "$services_to_restart" >/dev/null 2>&1 || : \
for service_name in $services_to_restart; do \
systemctl --quiet restart "$service_name" >/dev/null 2>&1 || : \
rm -f "%{_localstatedir}/lib/rpm-state/$service_name/active" >/dev/null 2>&1 || : \
done \
fi
Expand Down Expand Up @@ -210,12 +210,14 @@ echo 'enable xroad-*.service' > %{_presetdir}/90-xroad.preset

%if 0%{?el7}
%set_default_java_version
sleep 3
%restart_xroad_services
%endif

%posttrans -p /bin/bash
%if 0%{?el8}
%set_default_java_version
sleep 3
%restart_xroad_services
%endif

Expand Down

0 comments on commit c231b21

Please sign in to comment.