2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Plugin proftpd_count: fix shellcheck issues

This commit is contained in:
Lars Kruse 2018-08-02 00:15:53 +02:00
parent b925a10155
commit 9c1689fbef

View File

@ -14,14 +14,13 @@
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
MAXLABEL=20
mktempfile () { mktempfile () {
mktemp -t $1 mktemp -t "$1"
} }
LOGFILE=${logfile:-/var/log/proftpd/xferlog} LOGFILE=${logfile:-/var/log/proftpd/xferlog}
LOGTAIL=${logtail:-`which logtail`} LOGTAIL=${logtail:-$(which logtail)}
STATEFILE=$MUNIN_PLUGSTATE/xferlog-count.offset STATEFILE=$MUNIN_PLUGSTATE/xferlog-count.offset
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
@ -47,17 +46,15 @@ fi
ftp_get=U ftp_get=U
ftp_put=U ftp_put=U
TEMP_FILE=`mktempfile munin-xferlog-count.XXXXXX` TEMP_FILE=$(mktempfile munin-xferlog-count.XXXXXX)
if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ] if [ -n "$TEMP_FILE" ] && [ -f "$TEMP_FILE" ]; then
then "$LOGTAIL" "$LOGFILE" "$STATEFILE" | grep "[[:space:]][oi][[:space:]]" >"$TEMP_FILE"
$LOGTAIL ${LOGFILE} $STATEFILE | grep "[[:space:]][oi][[:space:]]" > ${TEMP_FILE} ftp_get=$(grep "[[:space:]]o[[:space:]]" "$TEMP_FILE" | wc -l)
ftp_get=`grep "[[:space:]]o[[:space:]]" ${TEMP_FILE} | wc -l` ftp_put=$(grep "[[:space:]]i[[:space:]]" "$TEMP_FILE" | wc -l)
ftp_put=`grep "[[:space:]]i[[:space:]]" ${TEMP_FILE} | wc -l`
/bin/rm -f $TEMP_FILE /bin/rm -f "$TEMP_FILE"
fi fi
echo "ftp_get.value ${ftp_get}" echo "ftp_get.value $ftp_get"
echo "ftp_put.value ${ftp_put}" echo "ftp_put.value $ftp_put"