Make your own free website on
Due to my use of an "old" version of SuSE I can't just get the latest version of clamav (anti-virus software for linux), but the folks at SuSE have a site that is updated with newer versions. Rather than checking each day to see if they have a newer version than me, I wrote this:

  # by Michael Mayer-Oakes
  # 6/13/2009
  # get the latest version for clamav from

  LOGNAME="/var/log/" # change this
  HEADER="Suse Projects Clamav Check"

  AWK=`which awk`            || AWK="/usr/bin/awk"
  SED=`which sed`            || SED="/usr/bin/sed"
  LOGGER=`which logger`	   || LOGGER="/usr/bin/logger"
  ECHO=`which echo`	   || ECHO="/bin/echo"
  DATE=`which date`	   || DATE="/bin/date"
  NAIL=`which nail`	   || NAIL="/usr/bin/nail"
  CLAMD=`which clamd`	   || CLAMD="/usr/sbin/clamd"

  # get current version of clamav, to check against available ones
  MYVERSION=`$CLAMD -V | $AWK '{print $2}' | $SED 's/\// /g' | $AWK '{print $1}'`

  $LOGGER -t $0[$$] Start $HEADER

  $ECHO " " >> $LOGNAME

  # set to script working directory
  cd "/path/to/script"
  # get the latest listing 
  cat projectsclamavinput | ftp -a > projectsclamavoutput
  # get list of all directories, each should be a version of clamav
  FILELIST="`grep 'clamav' projectsclamavoutput | awk '// {print $9}' | sed '/clamav-/s///'`"
  $ECHO "Got list of versions from Suse" >> $LOGNAME

     $ECHO "version "$FILE" found" >> $LOGNAME
     FILEVERSIONINT=`echo $FILE | sed '/\./s//0/g'`
     MYVERSIONINT=`echo $MYVERSION | sed '/\./s//0/g'`
     # testing MYVERSIONINT="0095"
     # TODO
     #	more testing here, when version 0.96 comes out this won't work
       $ECHO "version "$FILE" is newer than current version "$MYVERSION >> $LOGNAME
       DIRECTORYLIST=`echo 'clamav-'$FILE`

  if [ $DIRECTORYLIST ]; then
    # send email
    $ECHO "Version "$DIRECTORYLIST | $NAIL -r -s "NEW clamav found"
    # build the FTP GET file
    echo "open" > projectclamavget 
    # i have an Intel 32 bit CPU, version 9 SuSE, "sles9-i386"
    echo "cd pub/projects/clamav/"$DIRECTORYLIST"/sles9-i386" >> projectclamavget
    # change this to your path
    echo "lcd /path/to/save/clamav/" >> projectclamavget
    echo "bin" >> projectclamavget  
    echo "prompt" >> projectclamavget  
    echo "mget *" >> projectclamavget  
    echo "quit" >> projectclamavget
    $ECHO "Created Clamav Version To Get From Suse "$DIRECTORYLIST >> $LOGNAME

    # get the files, listed above
    cat projectclamavget | ftp -a > projectclamavgetoutput

  $LOGGER -t $0[$$] End $HEADER

  # end of script
Along with this projectsclamavinput file
  cd pub/projects/clamav
  ls -l  
And last but not least a cron entry, something like this
  0 1 * * * /path/to/script/
Now you are ready to go and keep up with the new versions of clamav. Heck, one could even install the new version after it was downloaded...