Re: [Clamav-users] how to set cron to run freshclam
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 >>> >>> 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 > The next line might be something like this: /usr/local/bin/freshclam --quiet -l /var/log/clamav/freshclam.log That will run fresh clam without any output to the console, and it will log the transaction as indicated. The other assumption is that you will not start freshclam in daemon mode. dp ___ Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net http://lurker.clamav.net/list/clamav-users.html
[Clamav-users] freshclam daemon mode. (was how to set cron to run freshclam)
freshclam can be run as a daemon now which works very well for updating without using cron. First edit /etc/freshclam.conf and set the values there to your environment Next run freshclam with the -d flag: /usr/bin/freshclam -d The Red Hat/Fedora/Centos RPMs already come with /etc/rc.d/init.d/freshclam and your distribution/OS should have some way of starting it at boot as well. Regards James > > HTH > > -- James Bourne | Email:[EMAIL PROTECTED] UNIX Systems Administration | WWW: http://www.hardrock.org Custom UNIX Programming | Linux: The choice of a GNU generation -- "All you need's an occasional kick in the philosophy." Frank Herbert ___ Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net http://lurker.clamav.net/list/clamav-users.html
Re: [Clamav-users] how to set cron to run freshclam
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
Re: [Clamav-users] freshclam destroys database
On Sun, 15 Apr 2007 06:51:22 -0400 Gerard Seibert <[EMAIL PROTECTED]> wrote: > On Sun, 15 Apr 2007 09:20:52 +0200 > Thomas <[EMAIL PROTECTED]> wrote: > > > I'm running clamav 0.90 on linux and i've been running freshclam once > > a day. Some days ago the clamd stopped working due to a missing > > database. I found out that it was freshclam that destroyed the > > database. After running freshclam the /var/lib/clamav directory looks > > like this: *.cvd daily.inc main.inc mirrors.dat > > > > What's up with the *.cvd? How is it possible that updating the virus > > database can detroy everything? > > > > Please help? > > > > B. regards, > > Thomas > > That problem has been reported already. I experienced it myself. To > correct it, I shut down clamav and freshclam, deleted the entire > contents of the directory and then restarted clamav and freshclam. That > took care of everything. I am not sure if an official fix has been > released however. The problem is not of clamav or freshclam's making. It's a the freshclam datadase directory cleanup script that sits in /etc/cron.daily where if there is no .cvd file in the database directory (usually /var/lib/clamav) a file named *.cvd is put there. There is a fix for this if you look further up this list you will find a post containing alternative code. I think this has now made it into the FC rpms, although I'm not absolutely certain. -- Brian Morrison bdm at fenrir dot org dot uk "Arguing with an engineer is like wrestling with a pig in the mud; after a while you realize you are muddy and the pig is enjoying it." GnuPG key ID DE32E5C5 - http://wwwkeys.uk.pgp.net/pgpnet/wwwkeys.html ___ Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net http://lurker.clamav.net/list/clamav-users.html
Re: [Clamav-users] freshclam destroys database
On Sun, 15 Apr 2007 09:20:52 +0200 Thomas <[EMAIL PROTECTED]> wrote: > I'm running clamav 0.90 on linux and i've been running freshclam once > a day. Some days ago the clamd stopped working due to a missing > database. I found out that it was freshclam that destroyed the > database. After running freshclam the /var/lib/clamav directory looks > like this: *.cvd daily.inc main.inc mirrors.dat > > What's up with the *.cvd? How is it possible that updating the virus > database can detroy everything? > > Please help? > > B. regards, > Thomas That problem has been reported already. I experienced it myself. To correct it, I shut down clamav and freshclam, deleted the entire contents of the directory and then restarted clamav and freshclam. That took care of everything. I am not sure if an official fix has been released however. HTH -- Gerard When among apes, one must play the ape. signature.asc Description: PGP signature ___ Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net http://lurker.clamav.net/list/clamav-users.html
Re: [Clamav-users] how to set cron to run freshclam
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
[Clamav-users] freshclam destroys database
Hi, I'm running clamav 0.90 on linux and i've been running freshclam once a day. Some days ago the clamd stopped working due to a missing database. I found out that it was freshclam that destroyed the database. After running freshclam the /var/lib/clamav directory looks like this: *.cvd daily.inc main.inc mirrors.dat What's up with the *.cvd? How is it possible that updating the virus database can detroy everything? Please help? B. regards, Thomas ___ Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net http://lurker.clamav.net/list/clamav-users.html