Handle sudo

This commit is contained in:
Alarig Le Lay 2019-02-04 11:08:29 +01:00
parent 86e7b3d20c
commit fd4ba3fc09

View file

@ -67,6 +67,8 @@ while :; do
esac
done
birdc="${SUDO} birdc"
test_route_limit() {
if [ "${ROUTE_HIT_IN}" != "" ]; then
printf "${protocol_name} has hit import route " >> \
@ -92,7 +94,7 @@ DIR="$(mktemp -d '/tmp/nrpe-bird.XXXX')"
# ${DIR}/bgp_protocols_up.txt
# 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")}'
if [ "$(cat ${DIR}/bird-err)" != '' ]; then
printf "ERROR: $(cat ${DIR}/bird-err)\n"