1.5 KiB
1.5 KiB
Runbook
This runbook explains how to execute and maintain the scripts in this repository.
Execution Model
Most scripts can be executed directly with Bash:
bash scripts/script_name.sh --help
For production usage, prefer absolute paths and explicit options:
/usr/bin/bash /opt/devops/scripts/system_health_report.sh --output /var/tmp/health.txt
Logging
Scripts print timestamped messages to standard output and standard error. When running through cron or a scheduler, redirect output to a dedicated log file:
bash scripts/docker_cleanup.sh --dry-run >> /var/log/docker-cleanup.log 2>&1
Permissions
Some scripts require elevated privileges:
- Docker maintenance requires access to the Docker daemon.
- User bootstrap usually requires root.
- Reading system services may require systemd access.
- Writing into deployment paths may require ownership or sudo.
Avoid running scripts as root unless the operation requires it.
Safety Checklist
Before scheduling or automating a script:
- Confirm the script exits non-zero on failure.
- Confirm the script handles missing dependencies.
- Confirm retention settings are aligned with business needs.
- Confirm secrets are supplied through secure environment variables or secret stores.
- Confirm logs do not expose passwords, tokens, or private keys.
Suggested CI Validation
At minimum, run:
bash tests/syntax_check.sh
If ShellCheck is available:
shellcheck scripts/*.sh tests/*.sh