gaboshlib/gaboshlib/g_echo_warn.bashfunc

21 lines
604 B
Bash

#!/bin/bash
function g_echo_warn {
[ -z "$1" ] && return 0
echo -en "\033[97m$(g_date_print) \033[33mWARNING: " 1>&2
cat <<< "$@" 1>&2
echo -en "\033[0m" 1>&2
g_logger WARN: $@
if ! [ $0 = /usr/local/bin/notify.sh ]
then
if [ -x /data/debian/usr/local/bin/notify.sh ]
then
cat <<< "$(date "+%F %T") $(hostname) $0($$) WARNING: $@" | debian-chroot.sh /usr/local/bin/notify.sh
elif [ -x /usr/local/bin/notify.sh ]
then
cat <<< "$(date "+%F %T") $(hostname) $0($$) WARNING: $@" | tail -n 100 | /usr/local/bin/notify.sh
fi
fi
[ -z $DISPLAY ] || zenity --notification --text="$@"
}