Obsolete Releases > SME 8.x Contribs
bash routine to update clamd virus definitions
purvis:
This routine will download and update the clamd virus definition files main.cvd, daily.cvd, and bytecode.cvd files.
You can set the web url location of where to get the files.
You can set a few variables in the routine to tell the routine to do a few things.
The routine downloads two sets of files and compares them for completeness.
The two sets of files are not deleted after the routine but left for testing and the
next time the routine is run.
When downloading the cvd files, if this routine finds the cvd files downloaded in the first set match the second set
from a previously download, then it will not download the second set of cvd files to save some time.
I am sure there are other fancy ways of getting the same results, but this is what I know how to do.
I would prefer bash routines had GOTO statements and LABELS, those would make bash routines a little easier for me to write small routines.
My coding is not perfect but it apparently gets the job done.
This program will keep two sets
--- Code: ---see a following post
--- End code ---
Stefano:
purvis..
thank you for your effort..
all your work/routines should be in the wiki
larieu:
Stefano
I have formatted the code for wiki
http://wiki.contribs.org/Talk:Clamav:freshclam_update
purvis:
Thank you both Stefano and larieu
Stefano, I had requested to be able to add a wiki some time ago and that request was either not processed or not honored for whatever reason.
That was fine with me. That is why i do not mind posting in this section of the forums.
Plus if I post a script or something here. It has an opportunity of being improved, checked, and tested by others before a wiki.
I am sorry about the wiki needing to be edited larieu.
I am also working on a script to not send any output except when an update fails.
purvis:
I found 1 error and 3 lines that need to be added in the above script.
2 lines added here
Freshclam update creates files that needed to be deleted
The code written did not do a full wildcard in the case the variable $clamdir was wrongly edited.
The safe approach was delete specific files.
Newer freshclam update files where not coded to be deleted which needed to be.
near the bottom of the routine, 2 lines need to be added below the line
--- Code: ---rm -f $clamdir/*.cvd 1> /dev/null 2> /dev/null
--- End code ---
--- Code: ---rm -f $clamdir/*.cld 1> /dev/null 2> /dev/null
rm -f $clamdir/mirrors.dat 1> /dev/null 2> /dev/null
--- End code ---
1 error fixed here and 1 line added here
very shortly after the first line of
--- Code: ---comparecvdfiles
--- End code ---
downloaddirectory=$downloaddirectory1 should be changed to
downloaddirectory=$downloaddirectory2
then under that line add
--- Code: --- downloadcvdfiles
--- End code ---
before the line of
dodownloadfilesexist
then the small section of code will read as
--- Code: ---comparecvdfiles
if [ $result == "0" ]
then
downloaddirectory=$downloaddirectory2
downloadcvdfiles
dodownloadfilesexist
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version