forked from evolix/evocheck
Merge branch 'verbose-mode' of evolix/evocheck into master
This commit is contained in:
commit
7bc903a315
24
evocheck.sh
24
evocheck.sh
|
@ -125,9 +125,17 @@ IS_NRPEDAEMON=1
|
||||||
IS_ALERTBOOT=1
|
IS_ALERTBOOT=1
|
||||||
IS_RSYNC=1
|
IS_RSYNC=1
|
||||||
|
|
||||||
|
# Verbose function
|
||||||
|
verbose() {
|
||||||
|
msg="${1:-$(cat /dev/stdin)}"
|
||||||
|
[ "${VERBOSE}" -eq 1 ] && [ -n "${msg}" ] && echo "${msg}"
|
||||||
|
}
|
||||||
|
|
||||||
# Source configuration file
|
# Source configuration file
|
||||||
test -f /etc/evocheck.cf && . /etc/evocheck.cf
|
test -f /etc/evocheck.cf && . /etc/evocheck.cf
|
||||||
|
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
# If --cron is passed, ignore some checks.
|
# If --cron is passed, ignore some checks.
|
||||||
if [ "$1" = "--cron" ]; then
|
if [ "$1" = "--cron" ]; then
|
||||||
IS_KERNELUPTODATE=0
|
IS_KERNELUPTODATE=0
|
||||||
|
@ -553,11 +561,7 @@ if [ -e /etc/debian_version ]; then
|
||||||
percentage=$(python -c "print(int(round(float(${reservedBlockCount})/${blockCount}*100)))")
|
percentage=$(python -c "print(int(round(float(${reservedBlockCount})/${blockCount}*100)))")
|
||||||
if [ "$percentage" -lt 5 ]; then
|
if [ "$percentage" -lt 5 ]; then
|
||||||
echo 'IS_TUNE2FS_M5 FAILED!'
|
echo 'IS_TUNE2FS_M5 FAILED!'
|
||||||
# Set debug to 1, to displays which partitions has less than 5%
|
verbose "Partition $part has less than 5% reserved blocks!"
|
||||||
debug=0
|
|
||||||
if [ "$debug" -eq 1 ]; then
|
|
||||||
echo "Partition $part has less than 5% reserved blocks!"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -839,14 +843,8 @@ if [ -e /etc/debian_version ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$IS_OLD_HOME_DIR" = 1 ]; then
|
if [ "$IS_OLD_HOME_DIR" = 1 ]; then
|
||||||
for dir in /home/*; do
|
find /home/ -maxdepth 1 -type d -nouser | grep -q '^' && echo 'IS_OLD_HOME_DIR FAILED!'
|
||||||
stat -c "%n has owner %u resolved as %U" "$dir" | grep -v .bak | grep -q UNKNOWN
|
[ "${VERBOSE}" -eq 1 ] && find /home/ -maxdepth 1 -type d -nouser -exec stat -c "%n has owner %u resolved as %U" {} \;
|
||||||
if [[ ${PIPESTATUS[2]} == 0 ]]; then
|
|
||||||
# There is at least one dir matching
|
|
||||||
echo 'IS_OLD_HOME_DIR FAILED!'
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue