Re-write disk free blocks
This commit is contained in:
parent
efeebe39f0
commit
29ddb35978
2 changed files with 31 additions and 6 deletions
25
i3/blocks/freeSpace
Executable file
25
i3/blocks/freeSpace
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/sh
|
||||||
|
|
||||||
|
partition=$1
|
||||||
|
|
||||||
|
if [ ! -n "$partition" ]; then
|
||||||
|
partition="/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
line=$(/usr/bin/df -h $partition | sed -n 2p)
|
||||||
|
|
||||||
|
used=$(echo $line | awk -F ' ' '{print $3}')
|
||||||
|
total=$(echo $line | awk -F ' ' '{print $2}')
|
||||||
|
percent=$(echo $line | awk -F ' ' '{print $5}' | sed 's/[^0-9]//')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "$used/$total $percent%"
|
||||||
|
echo "$used/$total"
|
||||||
|
|
||||||
|
if [ "$percent" -gt 80 ]; then
|
||||||
|
echo "#FF8000"
|
||||||
|
elif [ "$percent" -gt 90 ]; then
|
||||||
|
echo "#FF0000"
|
||||||
|
fi
|
|
@ -90,7 +90,6 @@ interval=once
|
||||||
# The type defaults to "mem" if the instance is not specified.
|
# The type defaults to "mem" if the instance is not specified.
|
||||||
[memory]
|
[memory]
|
||||||
label=MEM
|
label=MEM
|
||||||
separator=false
|
|
||||||
interval=30
|
interval=30
|
||||||
|
|
||||||
# Disk usage
|
# Disk usage
|
||||||
|
@ -99,14 +98,15 @@ interval=30
|
||||||
# The script may be called with a optional argument to set the alert
|
# The script may be called with a optional argument to set the alert
|
||||||
# (defaults to 10 for 10%).
|
# (defaults to 10 for 10%).
|
||||||
[disk]
|
[disk]
|
||||||
label=HOME
|
command=~/.dotfiles/i3/blocks/freeSpace
|
||||||
#instance=/mnt/data
|
label=/
|
||||||
|
instance=/
|
||||||
interval=30
|
interval=30
|
||||||
separator=false
|
|
||||||
|
|
||||||
[disk]
|
[disk]
|
||||||
label=ROOT
|
command=~/.dotfiles/i3/blocks/freeSpace /home
|
||||||
instance=/
|
label=/home
|
||||||
|
#instance=/mnt/data
|
||||||
interval=30
|
interval=30
|
||||||
|
|
||||||
# Network interface monitoring
|
# Network interface monitoring
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue