Handle bird error
This commit is contained in:
parent
1ebc61e84a
commit
86e7b3d20c
|
@ -94,7 +94,7 @@ DIR="$(mktemp -d '/tmp/nrpe-bird.XXXX')"
|
||||||
# The sed removes the first two lines (BIRD 2.0.2 ready and Name Proto blah)
|
# The sed removes the first two lines (BIRD 2.0.2 ready and Name Proto blah)
|
||||||
birdc 'show protocols all' 2>${DIR}/bird-err | sed '1,2d;$d' | \
|
birdc 'show protocols all' 2>${DIR}/bird-err | sed '1,2d;$d' | \
|
||||||
awk -v RS= -v DIR=$DIR '{print > (DIR "/" $1 ".txt")}'
|
awk -v RS= -v DIR=$DIR '{print > (DIR "/" $1 ".txt")}'
|
||||||
if [ $(cat ${DIR}/bird-err) != '' ]; then
|
if [ "$(cat ${DIR}/bird-err)" != '' ]; then
|
||||||
printf "ERROR: $(cat ${DIR}/bird-err)\n"
|
printf "ERROR: $(cat ${DIR}/bird-err)\n"
|
||||||
rm -r ${DIR}
|
rm -r ${DIR}
|
||||||
exit 2
|
exit 2
|
||||||
|
|
Loading…
Reference in a new issue