2d3f9e8
#! /bin/bash
2d3f9e8
# Copyright (C) 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
2d3f9e8
#
2d3f9e8
# This program is free software; you can redistribute it and/or modify
2d3f9e8
# it under the terms of the GNU General Public License as published by
2d3f9e8
# the Free Software Foundation; version 2 of the License.
2d3f9e8
#
2d3f9e8
# This program is distributed in the hope that it will be useful,
2d3f9e8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
2d3f9e8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2d3f9e8
# GNU General Public License for more details.
2d3f9e8
#
2d3f9e8
# You should have received a copy of the GNU General Public License
2d3f9e8
# along with this program; if not, write to the Free Software
2d3f9e8
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2d3f9e8
2d3f9e8
2d3f9e8
FRESHCLAM_MOD=$[ 3*60 ]		# 3 hours
2d3f9e8
2d3f9e8
f=/etc/sysconfig/freshclam
2d3f9e8
test ! -e "$f" || . "$f"
2d3f9e8
2d3f9e8
2d3f9e8
case x"$1" in
2d3f9e8
    (xnow)		FRESHCLAM_DELAY=0;;
2d3f9e8
    (x|xrandom)		: ${FRESHCLAM_DELAY:=$[ 0x`hostid` ]};;
2d3f9e8
    (*)			FRESHCLAM_DELAY=$1;;
2d3f9e8
esac
2d3f9e8
2d3f9e8
set -e
2d3f9e8
2d3f9e8
case $FRESHCLAM_DELAY in
2d3f9e8
    (disabled-warn)
2d3f9e8
	echo $"\
2d3f9e8
WARNING: update of clamav database is disabled; please see
2d3f9e8
  '$f'
2d3f9e8
  for information how to enable the periodic update resp. how to turn
2d3f9e8
  off this message." >&2
2d3f9e8
	exit 1
2d3f9e8
	;;
2d3f9e8
2d3f9e8
    (disabled)
2d3f9e8
	exit 0
2d3f9e8
	;;
2d3f9e8
2d3f9e8
    (*)
2d3f9e8
	let FRESHCLAM_MOD*=60
2d3f9e8
	sleep $[ (FRESHCLAM_DELAY % FRESHCLAM_MOD + FRESHCLAM_MOD) % FRESHCLAM_MOD ]
2d3f9e8
	;;
2d3f9e8
esac
2d3f9e8
c5b5449
/usr/bin/freshclam --quiet > /dev/null