~emersion/dotfiles

ref: a9c02aa5 dotfiles/bin/check-disk-usage -rwxr-xr-x 312 bytes
a9c02aa5Simon Ser ssh: add gabe.freedesktop.org a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh -eu

usage="$(df -P | sed 1d)"
echo "$usage" | while IFS="" read -r l; do
	pct="$(echo "$l" | tr -s " " | cut -d " " -f 5)"
	path="$(echo "$l" | tr -s " " | cut -d " " -f 6)"

	pct="${pct%"%"}"
	if [ "$pct" -ge 95 ]; then
		notify-send -u critical "$path is full" "Drive is at $pct% capacity"
	fi
done