fix: guard --output-dir arg and use configurable ZOMBIE_WARN threshold
All checks were successful
Auto-merge docs-only PRs / auto-merge-docs (pull_request) Successful in 3s
All checks were successful
Auto-merge docs-only PRs / auto-merge-docs (pull_request) Successful in 3s
- Validate --output-dir has a following argument before accessing $2 (prevents unbound variable crash under set -u) - Add ZOMBIE_WARN config variable (default: 1) and use it in the zombie check instead of hardcoding 0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
312434aa95
commit
c0b164b2f7
@ -27,10 +27,15 @@ DISK_WARN=80
|
|||||||
DISK_CRIT=90
|
DISK_CRIT=90
|
||||||
LOAD_WARN=2.0
|
LOAD_WARN=2.0
|
||||||
MEM_WARN=85
|
MEM_WARN=85
|
||||||
|
ZOMBIE_WARN=1
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--output-dir)
|
--output-dir)
|
||||||
|
if [[ $# -lt 2 ]]; then
|
||||||
|
echo "Error: --output-dir requires an argument" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
REPORT_DIR="$2"
|
REPORT_DIR="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
@ -179,7 +184,7 @@ parse_and_report() {
|
|||||||
;;
|
;;
|
||||||
ZOMBIES=*)
|
ZOMBIES=*)
|
||||||
local zombies="${line#ZOMBIES=}"
|
local zombies="${line#ZOMBIES=}"
|
||||||
if [[ -n "$zombies" ]] && ((zombies > 0)); then
|
if [[ -n "$zombies" ]] && ((zombies >= ZOMBIE_WARN)); then
|
||||||
echo "WARN $label: ${zombies} zombie process(es)" >>"$FINDINGS_FILE"
|
echo "WARN $label: ${zombies} zombie process(es)" >>"$FINDINGS_FILE"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user