Better script to avoid re-download of the same file:
#!/bin/sh
url="
http://www.mailscanner.eu/scamnailer.ndb"
wget="/usr/bin/wget"
target_dir="/var/clamav"
output_file="scamnailer.ndb"
clam_user="clamav:clamav"
tmp_dir="/var/cache/scamnailer"
start_date=`date`
mkdir -p $tmp_dir
cd $tmp_dir
echo "Getting signature file from scamnailer site ..."
$wget $url -N > $tmp_dir/log 2>&1
echo "done."
result=`cat $tmp_dir/log | grep -i 'not retrieving' | wc -l`
if [ $result -eq "1" ] ; then
stop_date=`date`
echo "Remote sig $output_file is like the local one: NO DOWNLOAD. EXIT NOW"
echo "Start Update Date: $start_date"
echo "Finish Update Date: $stop_date"
exit 1
fi
echo "Copying new $output_file to $target_dir ..."
cp "$tmp_dir/$output_file" $target_dir
chown $clam_user "$target_dir/$output_file"
echo "done."
stop_date=`date`
echo "Start Update Date: $start_date"
echo "Finish Update Date: $stop_date"