Hands-on task
Healthcheck with a Failure Log
Write /usr/local/bin/healthlog that takes a URL: if the URL responds 200 — stay silent, otherwise (any other code, or the server is unreachable) append DOWN <url> to /var/log/health.log. Test it against the unreachable http://localhost:59999/.
The script is handy to write in the Editor tab: the /usr/local/bin directory shows up there in the file tree; run and test it in the terminal.
- healthcheck
- curl
- http codes
- bash scripts
- script arguments