fix: CrowdSec RPC process detection

Fixed pgrep command to detect running CrowdSec process:
- Changed from `pgrep -x crowdsec` to `pgrep crowdsec`
- The -x flag requires exact process name match which wasn't working
- Affects both check_cscli() and get_status() functions
- Now correctly detects service as running in dashboard

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-01-06 16:25:59 +01:00
parent d1788a12ff
commit 878faf5bec

View File

@ -23,7 +23,7 @@ check_cscli() {
fi
# Check if crowdsec service is running
if ! pgrep -x crowdsec >/dev/null 2>&1; then
if ! pgrep crowdsec >/dev/null 2>&1; then
echo '{"error": "crowdsec service not running"}'
exit 1
fi
@ -107,7 +107,7 @@ get_status() {
json_init
# CrowdSec service
if pgrep -x crowdsec >/dev/null 2>&1; then
if pgrep crowdsec >/dev/null 2>&1; then
json_add_string "crowdsec" "running"
else
json_add_string "crowdsec" "stopped"