source: npl/mailserver/clamav_conf/syn3-clamav @ 105afb5

Last change on this file since 105afb5 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 902 bytes
Line 
1#!/bin/bash
2
3#SYN-3 clamav updater and monitoring
4#(C)2010 DatuX
5
6OUTPUT=/tmp/syn3clam.$$
7trap "rm '$OUTPUT'" 0
8
9#update scanner
10freshclam &> $OUTPUT
11EXIT=$?
12
13#update when ok?
14if grep -v 'Clamd was NOT notified' $OUTPUT | grep "^WARNING: " >/dev/null; then
15    MSG="`grep '^WARNING: ' $OUTPUT`"
16elif [ "$EXIT" != "0" ] && [ "$EXIT" != "1" ]; then
17    MSG="Error while updating virus scanner."
18fi
19
20#create test virus
21cat /usr/share/clamav/eicar.com.1 /usr/share/clamav/eicar.com.2 > /tmp/clamavtest
22chmod 555 /tmp/clamavtest
23
24#use deamon or not?
25if netstat -na|grep /var/run/clamav/clamd >/dev/null; then
26    CLAM=clamdscan
27else
28    CLAM=clamscan
29fi
30
31#test scanner
32if $CLAM /bin/bash /tmp/clamavtest | grep -x 'Infected files: 1' >/dev/null; then
33        syn3-state clamav OK "Virus scanner self-test was OK. $MSG"
34else
35        syn3-state clamav CAUTION "Virus scanner self-test failed. $MSG"
36fi
37
38rm /tmp/clamavtest
39
Note: See TracBrowser for help on using the repository browser.