Conservative SmartOS global-zone memory pressure guard with dry-run-first policy and SMF integration.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

35 行
1.0 KiB

  1. #!/bin/sh
  2. set -eu
  3. manifest=smf/o6h-memory-guard.xml
  4. config=etc/o6h-memory-guard.conf
  5. if grep -Fq -- '--force-dry-run' "$manifest"; then
  6. echo 'FAIL SMF manifest must not force dry-run' >&2
  7. exit 1
  8. fi
  9. test "$(grep -Fxc ' exec="/opt/custom/bin/o6h-memory-guard --daemon --config /opt/custom/etc/o6h-memory-guard.conf"' "$manifest")" -eq 1
  10. test "$(grep -Fxc ' <common_name><loctext xml:lang="C">o6h memory pressure guard</loctext></common_name>' "$manifest")" -eq 1
  11. test "$(grep -Fxc 'ACTION_MODE dry-run' "$config")" -eq 1
  12. while IFS= read -r setting; do
  13. test "$(grep -Fxc "$setting" "$config")" -eq 1
  14. done <<'EOF'
  15. PRE_SECONDS 1
  16. PRESSURE_SECONDS 2
  17. CRITICAL_SECONDS 2
  18. RECOVERY_SECONDS 15
  19. CRITICAL_TERM_GRACE_SECONDS 5
  20. EMERGENCY_TERM_GRACE_SECONDS 1
  21. FLOOR_KILL_DELAY_SECONDS 0
  22. MAX_CACHED_CANDIDATE_AGE_SECONDS 15
  23. MAX_VICTIMS_EPISODE 4
  24. MAX_VICTIMS_MINUTE 4
  25. MAX_EMERGENCY_VICTIMS_EPISODE 8
  26. MAX_FLOOR_VICTIMS_EPISODE 12
  27. EOF
  28. grep -Fq -- '"--force-dry-run"' src/main.c
  29. echo 'PASS distribution defaults to ACTION_MODE dry-run; production SMF does not force it'