#!/bin/bash
sa-update
code1=$?
if [[ $code1 > 1 ]]; then
  echo "problem with sa-update"
fi  
sa-update --gpgkey D1C035168C1EBC08464946DA258CDB3ABDE9DC10 --channel saupdates.openprotect.com
code2=$?
if [[ $code2 > 1 ]]; then
  echo "problem with openprotect update"
fi  
if [[ `expr $code1 + $code2` < 2 ]]; then
  spamassassin --lint
  code3=$?
  if [[ $code3 = 0 ]]; then
    /etc/init.d/amavis restart >/dev/null
  else
    echo "spamassassin failed to lint"
  fi
fi

