X-Git-Url: https://gerrit.nordix.org/gitweb?a=blobdiff_plain;f=clamav%2Fetc%2Fcron.daily%2Fclamav;fp=clamav%2Fetc%2Fcron.daily%2Fclamav;h=2106235ef96d2aee9ec798f05e392a1352d5a39a;hb=8d81b3eb80e7c2d8117f1e4dd5de05a0251c38f5;hp=2ac26f8674d300d4ea3919172c3fade490a90984;hpb=44ec876a584bc9d19d55278186ad1ee1b42005b4;p=infra%2Ftools.git diff --git a/clamav/etc/cron.daily/clamav b/clamav/etc/cron.daily/clamav index 2ac26f8..2106235 100755 --- a/clamav/etc/cron.daily/clamav +++ b/clamav/etc/cron.daily/clamav @@ -52,6 +52,7 @@ if [ ! -f /var/lib/clamav/daily.cld -o ! -x /usr/bin/clamscan -o ! -d /var/log/c then echo "$DATE: clamav is not installed or is incorrectly installed." >> $ERRORLOG notify-send-user -i /usr/share/pixmaps/clamtk.png -u critical "clamav: software not installed correctly" + chmod a+r $ERRORLOG exit 1 fi @@ -59,6 +60,7 @@ fi if [ ! -f $SCANEXC ] then echo "$DATE: File $SCANEXC does not exist." >> $ERRORLOG + chmod a+r $ERRORLOG notify-send-user -i /usr/share/pixmaps/clamtk.png -u critical "clamav: File $SCANEXC not found" exit 2 fi @@ -66,14 +68,11 @@ fi # Read and set up the path and file excludes . $SCANEXC >/dev/null 2>&1 -# File permissions for file creations -umask 0027 - # Create the scan log file if it doesn't exist if [ -f $SCANLOG ] then # Compress the previous scan log - TIMESTAMP=`date +"%s"` + TIMESTAMP=`date +"%Y-%m-%d_%T"` gzip -9 -c $SCANLOG > ${SCANLOG}-${TIMESTAMP}.gz else touch -t 000001010000 $SCANLOG @@ -90,11 +89,12 @@ rm $SCANLOG mkdir -p $SCANQNT ionice -c 3 nice /usr/bin/clamscan --file-list=$SCANFIL --log=$SCANLOG --infected --copy=$SCANQNT >/dev/null 2>&1 -DATE=`date -u` echo "Finish time: $DATE" >> $SCANLOG +chmod a+r $SCANLOG + # Check if any viruses were found -INFECTED_FILE_COUNT=`grep '^Infected files: ' /var/log/clamav/scan.log | sed 's/^Infected files: //'` +INFECTED_FILE_COUNT=`grep '^Infected files: ' /var/log/clamav/scan.log | sed 's/^Infected files: //'` if [ "$INFECTED_FILE_COUNT" -gt "0" ] then notify-send-user -i /usr/share/pixmaps/clamtk.png -u critical "clamav: $INFECTED_FILE_COUNT infected files found" "see $SCANLOG for details" @@ -102,4 +102,5 @@ then fi rm -f $SCANFIL + exit 0