Print log if error occurs

This commit is contained in:
Johannes 'fish' Ziemke 2016-12-21 11:51:53 +01:00
parent 481392d75c
commit ac406e652e

View File

@ -24,7 +24,6 @@ collectors=$(cat << COLLECTORS
megacli megacli
COLLECTORS COLLECTORS
) )
cd "$(dirname $0)" cd "$(dirname $0)"
port="$((10000 + (RANDOM % 10000)))" port="$((10000 + (RANDOM % 10000)))"
@ -74,11 +73,13 @@ fi
echo $! > "${tmpdir}/node_exporter.pid" echo $! > "${tmpdir}/node_exporter.pid"
finish() { finish() {
if [ ${verbose} -ne 0 ] if [ $? -ne 0 -o ${verbose} -ne 0 ]
then then
echo "LOG =====================" cat << EOF >&2
cat "${tmpdir}/node_exporter.log" LOG =====================
echo "=========================" $(cat "${tmpdir}/node_exporter.log")
=========================
EOF
fi fi
if [ ${update} -ne 0 ] if [ ${update} -ne 0 ]