Skip to content

Commit 1b31bf2

Browse files
f-gallandAlexRuiz7
authored andcommitted
Move restart block to %preun (#725)
1 parent 3200670 commit 1b31bf2

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

distribution/packages/src/rpm/wazuh-indexer.rpm.spec

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,22 @@ if command -v systemd-tmpfiles > /dev/null; then
206206
systemd-tmpfiles --create %{name}.conf
207207
fi
208208

209+
if [ ! -f %{tmp_dir}/wazuh-indexer.restart ]; then
210+
# Messages
211+
echo "###"
212+
echo "### NOT starting on installation, please execute the following statements to configure wazuh-indexer service to start automatically using systemd"
213+
echo " sudo systemctl daemon-reload"
214+
echo " sudo systemctl enable wazuh-indexer.service"
215+
echo "### You can start wazuh-indexer service by executing"
216+
echo " sudo systemctl start wazuh-indexer.service"
217+
echo "###"
218+
fi
219+
220+
exit 0
221+
222+
%preun
223+
set -e
224+
209225
if [ -f %{tmp_dir}/wazuh-indexer.restart ]; then
210226
rm -f %{tmp_dir}/wazuh-indexer.restart
211227
if command -v systemctl > /dev/null; then
@@ -215,16 +231,6 @@ if [ -f %{tmp_dir}/wazuh-indexer.restart ]; then
215231
fi
216232
fi
217233

218-
# Messages
219-
echo "### NOT starting on installation, please execute the following statements to configure wazuh-indexer service to start automatically using systemd"
220-
echo " sudo systemctl daemon-reload"
221-
echo " sudo systemctl enable wazuh-indexer.service"
222-
echo "### You can start wazuh-indexer service by executing"
223-
echo " sudo systemctl start wazuh-indexer.service"
224-
exit 0
225-
226-
%preun
227-
set -e
228234
if command -v systemctl >/dev/null && systemctl is-active %{name}.service >/dev/null; then
229235
echo "Stop existing %{name}.service"
230236
systemctl --no-reload stop %{name}.service
@@ -233,6 +239,7 @@ if command -v systemctl >/dev/null && systemctl is-active %{name}-performance-an
233239
echo "Stop existing %{name}-performance-analyzer.service"
234240
systemctl --no-reload stop %{name}-performance-analyzer.service
235241
fi
242+
236243
exit 0
237244

238245
%files -f %{_topdir}/filelist.txt

0 commit comments

Comments
 (0)