I am trying to run clamscan from a cron job. I have written a bash script for that, which i attached below. I am sorry it is in german language an not in polish.

The batch works fine when i start it from the command line. freshclam returns 52, because it can't handle the Microsoft NTLM proxy and clamscan returns 0 or 1.

Running as a cron job, both programs return 127 and also there is no logging output from the programs. Is this a clamav problem or is the script buggy?

I am using clamscan 0.67-1 on a United Linux 1.0.

Hayo Schmidt

-------------------------------------------------------------------
#!/bin/bash

echo ClamScanne nach Viren...
echo Starte Scannen.... >> /var/log/clam.log
date >> /var/log/clam.log

export RESULT=0

freshclam -v --log-verbose --log=/var/log/clam.log
echo freshclam gibt $? zurueck. >> /var/log/clam.log

clamscan -i -r --log-verbose --move=/QUARANTINE --log=/var/log/clam.log /pub

export RESULT=$?
case $RESULT in
0)
echo /pub ist virenfrei.
echo "/pub ist virenfrei." | /usr/bin/mail -s "virenfrei" root
echo /pub ist virenfrei. >> /var/log/clam.log
;;
1)
echo Viren in /pub gefunden!
echo "Viren in /pub gefunden!" | /usr/bin/mail -s "VIREN ALARM" root
echo Viren in /pub gefunden! >> /var/log/clam.log
;;
*)
echo clamscan gibt $RESULT zurueck.
echo "clamscan gibt was falsches zurueck (/pub)." | mail -s "clamscan mit $RESULT abgebrochen" root
echo "clamscan gibt $RESULT zurueck (/pub)." >> /var/log/clam.log
;;
esac


clamscan -i -r --log-verbose --move=/QUARANTINE --log=/var/log/clam.log /home

export RESULT=$?
case $RESULT in
0)
echo /home ist virenfrei.
echo /home ist virenfrei. | /usr/bin/mail -s "virenfrei" root
echo /home ist virenfrei. >> /var/log/clam.log
;;
1)
echo Viren in /home gefunden!
echo Viren in /home gefunden! | /usr/bin/mail -s "VIREN ALARM" root
echo Viren in /home gefunden! >> /var/log/clam.log
;;
*)
echo clamscan gibt $RESULT zurueck.
echo "clamscan gibt was falsches zurueck (/home)." | /usr/bin/mail -s "clamscan mit $RESULT abgebrochen" root
echo "clamscan gibt $RESULT zurueck (/home)." >> /var/log/clam.log
;;
esac


echo Fertig mit Viren scannen. \($RESULT\)
echo Fertig mit Viren scannen. \($RESULT\)  >> /var/log/clam.log
exit $RESULT



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Clamav-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-users

Reply via email to