Message: - remove the use of tempfiles. (D: Closes #668778) Index: /trunk/plugins/node.d/qmailscan.in =================================================================== --- /trunk/plugins/node.d/qmailscan.in (revision 3962) +++ /trunk/plugins/node.d/qmailscan.in (revision 4819) @@ -38,27 +38,22 @@ echo 'graph_vlabel Daily Virus Types' echo 'graph_category Mail' - grep "`date +%d\ %b\ %Y`" $LOG0 $LOG1 > /tmp/q$$ - egrep -v 'Disallowed characters found in MIME headers|Disallowed breakage found in header name - potential virus|Disallowed MIME comment found in header name - potential virus' /tmp/q$$ > /tmp/q2$$ - sed 's/clamdscan.*$//' /tmp/q2$$ | sed 's/[ \t]*$//' > /tmp/q$$ - cut -f 5 /tmp/q$$ | sort | uniq -c | sort -r | sed 's/\.\|-/_/g' | while read i; do - name=`echo $i | awk '{print $2}'`; - echo "$name.label $name" ; - echo "'$name.draw LINE2"; - done - rm /tmp/q$$ /tmp/q2$$ + grep "`date +%d\ %b\ %Y`" $LOG0 $LOG1 | \ + grep -v 'Disallowed characters found in MIME headers|Disallowed breakage found in header name - potential virus|Disallowed MIME comment found in header name - potential virus' | \ + sed 's/clamdscan.*$//' | sed 's/[ \t]*$//' | \ + cut -f 5 | sort | uniq -c | sort -r | sed 's/\.\|-/_/g' | while read i; do + name=`echo $i | awk '{print $2}'`; + echo "$name.label $name" ; + echo "'$name.draw LINE2"; + done exit 0 fi -grep "`date +%d\ %b\ %Y`" $LOG0 $LOG1 > /tmp/q$$ -egrep -v 'Disallowed characters found in MIME headers|Disallowed breakage found in header name - potential virus|Disallowed MIME comment found in header name - potential virus' /tmp/q$$ > /tmp/q2$$ -sed 's/clamdscan.*$//' /tmp/q2$$ | sed 's/[ \t]*$//' > /tmp/q$$ - -#awk '{ print $NF }' /tmp/q$$ | sort | uniq -c | sed 's/\./_/g' | while read i; do -cut -f 5 /tmp/q$$ | sort | uniq -c | sort -r | sed 's/\.\|-/_/g' | while read i; do - name=`echo $i | awk '{print $2}'`; - printf "%s.value " $name; - echo $i | awk '{print $1}' -done - -rm /tmp/q$$ /tmp/q2$$ +grep "`date +%d\ %b\ %Y`" $LOG0 $LOG1 | \ + egrep -v 'Disallowed characters found in MIME headers|Disallowed breakage found in header name - potential virus|Disallowed MIME comment found in header name - potential virus' | \ + sed 's/clamdscan.*$//' | sed 's/[ \t]*$//' | \ + cut -f 5 | sort | uniq -c | sort -r | sed 's/\.\|-/_/g' | while read i; do + name=`echo $i | awk '{print $2}'`; + printf "%s.value " $name; + echo $i | awk '{print $1}' + done