Skip to content

Commit

Permalink
Ignore 2 and 1 exit codes on status validation
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Jan 6, 2025
1 parent 96338b8 commit f03e321
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions distribution/packages/src/rpm/wazuh-indexer.rpm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ exit 0

%pre
set -e


echo "pre-install script"
# Stop existing wazuh-indexer service
if command -v systemctl >/dev/null && systemctl is-active %{name}.service >/dev/null; then
echo "Stop existing %{name}.service"
Expand All @@ -170,7 +169,7 @@ elif command -v service >/dev/null && service %{name} status >/dev/null; then
echo "Stop existing %{name} service"
touch %{restart_service}
service %{name} stop
elif command -v /etc/init.d/%{name} >/dev/null && /etc/init.d/%{name} status >/dev/null; then
elif command -v /etc/init.d/%{name} >/dev/null && /etc/init.d/%{name} status >/dev/null 2>&1; then
echo "Stop existing %{name} service"
touch %{restart_service}
/etc/init.d/%{name} stop
Expand All @@ -185,7 +184,6 @@ elif command -v service >/dev/null && service %{name}-performance-analyzer statu
elif command -v /etc/init.d/%{name}-performance-analyzer >/dev/null && /etc/init.d/%{name}-performance-analyzer status >/dev/null; then
echo "Stop existing %{name}-performance-analyzer service"
/etc/init.d/%{name}-performance-analyzer stop

fi

# Create user and group if they do not already exist.
Expand Down Expand Up @@ -243,6 +241,7 @@ if [ -f %{restart_service} ]; then
/etc/init.d/wazuh-indexer restart > /dev/null 2>&1
fi
rm -f %{restart_service}
echo "wazuh-indexer service restarted."
exit 0
fi

Expand All @@ -268,14 +267,15 @@ exit 0

%preun
set -e
echo "pre-uninstall script"
# Stop existing wazuh-indexer service
if command -v systemctl >/dev/null && systemctl is-active %{name}.service >/dev/null; then
echo "Stop existing %{name}.service"
systemctl --no-reload stop %{name}.service
elif command -v service >/dev/null && service %{name} status >/dev/null; then
echo "Stop existing %{name} service"
service %{name} stop
elif command -v /etc/init.d/%{name} >/dev/null && /etc/init.d/%{name} status >/dev/null; then
elif command -v /etc/init.d/%{name} >/dev/null && /etc/init.d/%{name} status >/dev/null 2>&1; then
echo "Stop existing %{name} service"
/etc/init.d/%{name} stop
fi
Expand Down

0 comments on commit f03e321

Please sign in to comment.