21 lines
604 B
Bash
21 lines
604 B
Bash
#!/bin/bash
|
|
|
|
function g_echo_error {
|
|
[ -z "$1" ] && return 0
|
|
echo -en "\033[97m$(g_date_print) \033[31mERROR:" 1>&2
|
|
cat <<< "$@" 1>&2
|
|
echo -en "\033[0m" 1>&2
|
|
g_logger ERROR: $@
|
|
if ! [ $0 = /usr/local/bin/notify.sh ]
|
|
then
|
|
if [ -x /data/debian/usr/local/bin/notify.sh ]
|
|
then
|
|
cat <<< "$(date "+%F %T") $(hostname) $0($$) ERROR: $@ " | debian-chroot.sh /usr/local/bin/notify.sh
|
|
elif [ -x /usr/local/bin/notify.sh ]
|
|
then
|
|
cat <<< "$(date "+%F %T") $(hostname) $0($$) ERROR: $@" | tail -n 100 | /usr/local/bin/notify.sh
|
|
fi
|
|
fi
|
|
[ -z $DISPLAY ] || zenity --error --ellipsize --text="$@"
|
|
}
|