Small improvement to remove error messages from df

This commit is contained in:
Ulf 2023-12-31 14:56:30 +01:00
parent a5f28c3d6d
commit 0571130cbd

20
dfc.sh
View file

@ -2,15 +2,17 @@
# df (= DiskFree) with some options and colored if Alert levels are exceeded # df (= DiskFree) with some options and colored if Alert levels are exceeded
# #
# (c) GPL by Ulf Bartolomäus # (c) GPL by Ulf Bartolomäus
VERSION="$( basename $0 ) Version 0.1.2 from 03.11.2021" VERSION="$( basename $0 ) Version 0.1.3 from 31.12.2023"
# #
# Input: -v : Version # Input: -v : Version
# -y YY : YY = alert level (yellow) in % (default = 80%) # -y YY : YY = alert level (yellow) in % (default = 80%)
# -r RR : RR = critical alert level (red) in % (default = 90%) # -r RR : RR = critical alert level (red) in % (default = 90%)
# Output: disk free information colored about mounted filesystems # Output: disk free information colored about mounted filesystems
# Returnvalue: 0 # Returnvalue: 0
# #
# Changes: # Changes:
# 0.1.3
# Add '2> /dev/null' at df to remove error messages
# 0.1.2 # 0.1.2
# Some format improfements and adding from options # Some format improfements and adding from options
# 0.1.1 # 0.1.1
@ -18,21 +20,21 @@ VERSION="$( basename $0 ) Version 0.1.2 from 03.11.2021"
## Definitions ## Definitions
#MyDfC='df -hT' ## df command: -h: human readeable, -T: show filesystem type #MyDfC='df -hT' ## df command: -h: human readeable, -T: show filesystem type
MyDfC='df -hTx tmpfs -x devtmpfs' ## df -hT command: excluding *tenpfs MyDfC='df -hTx tmpfs -x devtmpfs 2> /dev/null' ## df -hT command: excluding *tenpfs
#MyDfC='df -hTx tmpfs -x devtmpfs -x fuse -x nfs4' ## df -hT command: excluding *tenpfs, fusa and nfs4 filesystems #MyDfC='df -hTx tmpfs -x devtmpfs -x fuse -x nfs4 2> /dev/null' ## df -hT command: excluding *tenpfs, fusa and nfs4 filesystems
MyDfAlert1=80 ## "yellow" for alert level for out of space MyDfAlert1=80 ## "yellow" for alert level for out of space
MyDfAlert2=90 ## "red" for critical alert for out of space MyDfAlert2=90 ## "red" for critical alert for out of space
## Escape secences for color ## Escape secences for color
esc=$(echo -en "\033") ## define esc secence esc=$(echo -en "\033") ## define esc secence
dick="${esc}[1m" ## define bold secence dick="${esc}[1m" ## define bold secence
rot="${esc}[1;31m" ## define red secence rot="${esc}[1;31m" ## define red secence
gruen="${esc}[1;32m" ## define green secence gruen="${esc}[1;32m" ## define green secence
gelb="${esc}[1;33m" ## define yelow secence gelb="${esc}[1;33m" ## define yelow secence
blau="${esc}[1;34m" ## define blue secence blau="${esc}[1;34m" ## define blue secence
lila="${esc}[1;35m" ## define purple secence lila="${esc}[1;35m" ## define purple secence
norm=$(echo -en "${esc}[m\017") ## define default secence norm=$(echo -en "${esc}[m\017") ## define default secence
## Shows the Version iformation ## Shows the Version iformation