1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

use "trap" to remove temporary file

This commit is contained in:
Stig Sandbeck Mathisen 2014-10-05 14:40:19 +02:00
parent e586cd5cb4
commit 6281364b67

View file

@ -55,6 +55,7 @@ NETSTAT=${netstat:-`which netstat`}
NETSTAT=${NETSTAT:-/usr/bin/netstat}
PORTS=${ports:-389 636}
TEMP_FILE=$(mktemp /tmp/munin_ldap.XXXXXX)
trap "rm -f ${TEMP_FILE}" EXIT
PATH=/bin:/usr/bin:/usr/local/bin
SOCKET=${socket:-/var/run/openldap/ldapi}
@ -96,7 +97,7 @@ if [ "$1" = "autoconf" ]; then
for port in $PORTS; do
ONE_LISTENING=${ONE_LISTENING}$(find_ips_bound $port)
done
rm -f $TEMP_FILE
if [ -n "$ONE_LISTENING" ]; then
echo yes
exit 0
@ -121,7 +122,7 @@ if [ "$1" = "config" ]; then
echo "socket.label ldapi"
fi
fi
rm -f $TEMP_FILE
exit 0
fi
@ -134,4 +135,3 @@ if [ -e "$SOCKET" ]; then
echo "socket.value $($NETSTAT -an ${FAMILYMARK}unix | grep $SOCKET | wc -l | sed 's/[[:space:]]*//g')"
fi
rm -f $TEMP_FILE