You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On non-systemd (SysV) systems, attempting to start the Wazuh-Indexer service using service wazuh-indexer start does not actually start the process. The service reports it started but immediately shows as not running when checked with service wazuh-indexer status.
Observed Behavior:
# service wazuh-indexer status * wazuh-indexer is not running
# service wazuh-indexer start * Starting wazuh-indexer
# service wazuh-indexer status * wazuh-indexer is not running
# ps -aux | grep -i wazuh(no wazuh-indexer process found)
This issue appears related to the line in the SysV init script where pidofproc -p $PID_FILE wazuh-indexer is executed. The pidofproc function returns an exit code of 3 (indicating the pid file is not exist), which prevents the $pid variable from being assigned and prematurely terminates the start sequence.
If pidofproc returns a non-zero code, the script never assigns $pid, causing the script to fail silently rather than proceeding with the start logic.
Objective
Fix the SysV init script for Wazuh-Indexer so that it properly handles the pidofproc return code, allowing the service to start and run as expected on SysV-based systems.
Acceptance Criteria
service wazuh-indexer start successfully launches Wazuh-Indexer on SysV init systems.
service wazuh-indexer status correctly reports the running status after starting.
service wazuh-indexer stop successfully stop Wazuh-Indexer on SysV init systems.
No errors or unexpected behavior occur in logs.
The text was updated successfully, but these errors were encountered:
juliancnn
changed the title
Wazuh-Indexer SysV Init Script Fails to Start the Service
Wazuh-Indexer SysV Init script fails to start the service
Dec 19, 2024
# service wazuh-indexer startStarting wazuh-indexer...wazuh-indexer started successfully
# service wazuh-indexer statuswazuh-indexer is running (PID: 2353)
Stop wazuh-indexer service
# service wazuh-indexer stopStopping wazuh-indexer... wazuh-indexer stopped successfully
# service wazuh-indexer statuswazuh-indexer is not running
Restart a running wazuh-indexer service
# sudo service wazuh-indexer restartStopping wazuh-indexer... wazuh-indexer stopped successfullyStarting wazuh-indexer...wazuh-indexer started successfully
Restart a stopped wazuh-indexer service
# service wazuh-indexer stopStopping wazuh-indexer... wazuh-indexer stopped successfully
# service wazuh-indexer restartStopping wazuh-indexer... wazuh-indexer is not runningStarting wazuh-indexer...wazuh-indexer started successfully
Related issues:
Description
On non-systemd (SysV) systems, attempting to start the Wazuh-Indexer service using
service wazuh-indexer start
does not actually start the process. The service reports it started but immediately shows as not running when checked withservice wazuh-indexer status
.Observed Behavior:
This issue appears related to the line in the SysV init script where
pidofproc -p $PID_FILE wazuh-indexer
is executed. Thepidofproc
function returns an exit code of3
(indicating the pid file is not exist), which prevents the$pid
variable from being assigned and prematurely terminates the start sequence.Relevant Code Snippet:
wazuh-indexer/distribution/packages/src/deb/init.d/wazuh-indexer
Lines 85 to 86 in a6476b2
pid=`pidofproc -p $PID_FILE wazuh-indexer`
If
pidofproc
returns a non-zero code, the script never assigns$pid
, causing the script to fail silently rather than proceeding with the start logic.Objective
Fix the SysV init script for Wazuh-Indexer so that it properly handles the
pidofproc
return code, allowing the service to start and run as expected on SysV-based systems.Acceptance Criteria
service wazuh-indexer start
successfully launches Wazuh-Indexer on SysV init systems.service wazuh-indexer status
correctly reports the running status after starting.service wazuh-indexer stop
successfully stop Wazuh-Indexer on SysV init systems.The text was updated successfully, but these errors were encountered: