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:
parent
e586cd5cb4
commit
6281364b67
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue