fix: redis_status - avoid JPS placeholder collision with bash default syntax, add redis-cli fallback detection

main
Anthony 2026-02-28 15:39:12 +08:00
parent b9c61347fb
commit 336449c366
1 changed files with 1 additions and 1 deletions

View File

@ -848,7 +848,7 @@ actions:
- cmd[cp]:
user: root
commands:
- RESULT=$(systemctl list-units --type=service --all | grep -i redis); [ -z "$RESULT" ] && RESULT=$(systemctl list-unit-files --type=service | grep -i redis | awk '{print $1, $2}'); echo "${RESULT:-No Redis service found}"
- RESULT=$(systemctl list-units --type=service --all | grep -i redis); if [ -z "$RESULT" ]; then RESULT=$(systemctl list-unit-files --type=service | grep -i redis | awk '{print $1, $2}'); fi; if [ -z "$RESULT" ]; then REDIS_CLI=$(which redis-cli 2>/dev/null); if [ -n "$REDIS_CLI" ]; then echo "Redis CLI found at $REDIS_CLI but no systemd service detected"; else echo "Redis is not installed or not managed by systemd on this node"; fi; else echo "$RESULT"; fi
- return:
type: info
message: "${response.out}"