motd: check only local filesystems
To avoid to block connections if a remote share is unavailable.
This commit is contained in:
parent
daada7a1db
commit
ea8b2bd657
|
@ -18,7 +18,7 @@ BOLD='\033[1m'
|
||||||
RESET='\033[0m'
|
RESET='\033[0m'
|
||||||
# ]]]
|
# ]]]
|
||||||
# Vars definition [[[
|
# Vars definition [[[
|
||||||
ROOT_PART_USAGE=$(df | grep -m1 "/$" | awk '{print $5}')
|
ROOT_PART_USAGE=$(df --local | grep -m1 "/$" | awk '{print $5}')
|
||||||
# ]]]
|
# ]]]
|
||||||
|
|
||||||
#+++++++++++++++++++: Disk Usage :+++++++++++++++++++
|
#+++++++++++++++++++: Disk Usage :+++++++++++++++++++
|
||||||
|
@ -35,8 +35,8 @@ printf '%b' "${BLACKB}+ ${WHITE}${PRINTF_ROOT_NAME}${RESET}${BLACKB}= ${CYAN}${R
|
||||||
# Other partition
|
# Other partition
|
||||||
for PART_NAME in /boot /home /opt /srv /tmp /tmp /usr /var /var/lib/docker /var/lib/vz; do
|
for PART_NAME in /boot /home /opt /srv /tmp /tmp /usr /var /var/lib/docker /var/lib/vz; do
|
||||||
## "/...$" : $ to grep only the mount point and not sub-directories (/var: OK; /mnt/temp: nOK)
|
## "/...$" : $ to grep only the mount point and not sub-directories (/var: OK; /mnt/temp: nOK)
|
||||||
if (df | grep "${PART_NAME}$" > /dev/null); then
|
if (df --local | grep "${PART_NAME}$" > /dev/null); then
|
||||||
PART_USAGE=$(df | grep "${PART_NAME}$" | awk '{print $5}')
|
PART_USAGE=$(df --local | grep "${PART_NAME}$" | awk '{print $5}')
|
||||||
PRINTF_PART_NAME=$(printf '%-22s' "${PART_NAME}")
|
PRINTF_PART_NAME=$(printf '%-22s' "${PART_NAME}")
|
||||||
printf '%b' "${BLACKB}+ ${WHITE}${PRINTF_PART_NAME}${RESET}${BLACKB}= ${CYAN}${PART_USAGE}${RESET}\\n"
|
printf '%b' "${BLACKB}+ ${WHITE}${PRINTF_PART_NAME}${RESET}${BLACKB}= ${CYAN}${PART_USAGE}${RESET}\\n"
|
||||||
fi
|
fi
|
||||||
|
@ -50,12 +50,12 @@ if [ "$(command -v zpool)" ]; then
|
||||||
printf '%b' " ${CYAN}${BOLD}ZFS${RESET} ${CYAN}Partition${RESET} "
|
printf '%b' " ${CYAN}${BOLD}ZFS${RESET} ${CYAN}Partition${RESET} "
|
||||||
printf "${BLACKB}%33s${RESET}\\n" | tr ' ' -
|
printf "${BLACKB}%33s${RESET}\\n" | tr ' ' -
|
||||||
|
|
||||||
NUMBER_PART=$(df -T | grep -c zfs)
|
NUMBER_PART=$(df --local --print-type | grep -c zfs)
|
||||||
LINE=1
|
LINE=1
|
||||||
|
|
||||||
while [ "${LINE}" -le "${NUMBER_PART}" ]; do
|
while [ "${LINE}" -le "${NUMBER_PART}" ]; do
|
||||||
DISK_USAGE=$(df -T | grep zfs | sed -n "${LINE},${LINE}p" | awk '{print $6}')
|
DISK_USAGE=$(df --local --print-type | grep zfs | sed -n "${LINE},${LINE}p" | awk '{print $6}')
|
||||||
PART_NAME=$(df -T | grep zfs | sed -n "${LINE},${LINE}p" | awk '{print $1}')
|
PART_NAME=$(df --local --print-type | grep zfs | sed -n "${LINE},${LINE}p" | awk '{print $1}')
|
||||||
PRINTF_PART_NAME=$(printf '%-23s' "${PART_NAME}")
|
PRINTF_PART_NAME=$(printf '%-23s' "${PART_NAME}")
|
||||||
printf '%b' "${BLACKB}+ ${WHITE}${PRINTF_PART_NAME}${RESET} ${CYAN}${DISK_USAGE}${RESET}\\n"
|
printf '%b' "${BLACKB}+ ${WHITE}${PRINTF_PART_NAME}${RESET} ${CYAN}${DISK_USAGE}${RESET}\\n"
|
||||||
LINE=$((LINE+1))
|
LINE=$((LINE+1))
|
||||||
|
|
Loading…
Reference in New Issue