On Sunday 15 April 2007 2:45 am, Pascal Duchatelle wrote: > Le Fri, 13 Apr 2007 08:26:42 -0700, > > Dennis Peterson <[EMAIL PROTECTED]> a écrit : > > Roger M wrote: > > > On Fri, 2007-04-13 at 13:26 +0200, Pascal Duchatelle wrote: > > >> Hello, > > >> I am not that much experienced with linux. > > >> I would like to have freshclam doing updates by itself. Until now > > >> I did the update manually. > > >> The clamav-update file in my /etc/cron.d directory is as follow: > > >> > > >> ## Adjust this line... > > >> MAILTO=root,postmaster,webmaster,clamav > > >> > > >> ## It is ok to execute it as root; freshclam drops privileges and > > >> becomes > > >> ## user 'clamav' as soon as possible > > > > > > go > > > > > > vi /etc/cron.hourly/freshclam > > > > > > then add > > > > > > /usr/local/bin/freshclam --quiet -l /var/log/clamav/freshclam.log
> > This is pretty much a bad idea. There is a tendency to run cron jobs > > thus: > > > > 0 * * * * freshclam > > > > Imagine thousands of people doing this and the load it imposes on the > > servers at the top of each hour. Better is to put in a time > > randomizer so that your freshclam is not fired off in lockstep with > > thousands of others. This simple bash code segment has been suggested > > (kudos to author): > > > > > > if [ -z "$1" ]; then > > /usr/bin/bash -c 'sleep $[ RANDOM % 1800 ]' > > fi > > Dennis. > since I am not much familiar with bash scripting, where is the > reference to the frashclam run command in the above if statement ? > is it the -z ? from what I understand the /usr/bin/bash -c 'sleep > $[ RANDOM % 1800 ]' passes a string as an option to the bash to make it > sleep for 1 to 1800 sec randomly. > Thank you > Pascal > I have this tiny script located in /usr/local/bin/freshclamcron: #!/bin/bash sleep $[ RANDOM % 3000 ] /usr/bin/freshclam --quiet --daemon-notify=/etc/clamd.conf exit I run it at 2 minutes after each hour, it will sleep for a random amount of time, up to 50 minutes, run freshclam and notify clamd of updates. The entry in my /etc/crontab file looks like this: 2 * * * * clamav /usr/local/bin/freshclamcron HTH -- Chris KeyID 0xE372A7DA98E6705C
pgpP9YsOOQOgH.pgp
Description: PGP signature
_______________________________________________ Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net http://lurker.clamav.net/list/clamav-users.html