check_dns.sh: some minor changes on script output.

This commit is contained in:
Christoph 2018-03-18 14:56:21 +01:00
parent e376c1ab4b
commit d58b7cc683

View File

@ -29,9 +29,17 @@ LOCK_DIR=`mktemp -d`
fatal(){
echo ""
echo -e " [ Fatal ] $*"
if $terminal ; then
echo -e " [ \033[31m\033[1mFatal\033[m ] $*"
else
echo -e " [ Fatal ] $*"
fi
echo ""
echo -e "\tScript terminated.."
if $terminal ; then
echo -e " \033[1mScript terminated\033[m.."
else
echo -e " Script terminated.."
fi
echo ""
rm -rf $LOCK_DIR
exit 1
@ -39,28 +47,54 @@ fatal(){
error (){
echo ""
echo -e " [ Error ] $*"
if $terminal ; then
echo -e " [ \033[31m\033[1mError\033[m ] $*"
else
echo " [ Error ] $*"
fi
echo ""
}
warn (){
echo ""
echo -e " [ Warn ] $*"
if $terminal ; then
echo -e " [ \033[33m\033[1mWarn\033[m ] $*"
else
echo " [ Warn ] $*"
fi
echo ""
}
info (){
echo ""
echo -e " [ Info ] $*"
if $terminal ; then
echo -e " [ \033[32m\033[1mInfo\033[m ] $*"
else
echo " [ Info ] $*"
fi
echo ""
}
ok (){
echo ""
echo -e " [ Ok ] $*"
if $terminal ; then
echo -e " [ \033[32m\033[1mOk\033[m ] $*"
else
echo " [ Ok ] $*"
fi
echo ""
}
fatal(){
echo ""
echo -e " [ Fatal ] $*"
echo ""
echo -e "\tScript terminated.."
echo ""
rm -rf $LOCK_DIR
exit 1
}
trim() {
local var="$*"
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
@ -78,8 +112,8 @@ trim() {
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
LOGGING=true
terminal=true
LOGGING=true
else
terminal=false
LOGGING=false