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 > > > > Then save and then: > > > > chmod 0755 /etc/cron.hourly/freshclam > > > > It will run updates every hour, if you want to update once a day > > then use cron.daily if once a week use cron.weekly. > > 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 > This creates a random number between 1 and 900 that becomes the > number of seconds the code sleeps before jumping into the fray. In > this case the delay can be up to 30 minutes (1800 seconds). > > To prevent concurrent sessions from running you should keep the delay > time value less than the cron period + run time of freshclam. > > The $1 allows you the option to over-ride the delay as in: > > freshclam.sh now > > So you might ask 'what is the benefit', and it is this: running a > mirror is a huge bandwidth hog, and helping the sysadmins balance > their loads with simple code like this shows we care about their > concerns and that we respect appreciate their contribution and show > it in our usage patterns. And it may prevent their being discouraged > to the point of shutting down their mirror. > > dp > _______________________________________________ > Help us build a comprehensive ClamAV guide: visit > http://wiki.clamav.net http://lurker.clamav.net/list/clamav-users.html _______________________________________________ Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net http://lurker.clamav.net/list/clamav-users.html