Hands-on task
Disk alert script
Write an executable script /usr/local/bin/disk-alert that takes two arguments: a path and a threshold in percent. If disk usage for that path is above the threshold — exit 1, otherwise exit 0.
The script is easiest to write in the Editor tab: /usr/local/bin shows up there in the file tree; run and test it in the terminal.
- bash scripts
- exit codes
- df
- positional arguments
- chmod