Hands-on task
Disk Alert
Write /usr/local/bin/disk-alert that computes the total size of the contents of the directory /var/data and, if it is greater than 50 MB, appends the line ALERT disk high to /var/log/alerts.log. Run it.
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.
- threshold alerting
- du
- bash scripts
- numeric comparison
- appending to a log