diff --git a/plugins/network/ldap_connections b/plugins/network/ldap_connections index 8d77d359..485cfdd4 100755 --- a/plugins/network/ldap_connections +++ b/plugins/network/ldap_connections @@ -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