Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Developers' Forum

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 4th November 2006, 23:59
djtremors djtremors is offline
Senior Member
Join Date: Apr 2006
Location: Sydney
Posts: 278
Thanks: 0
Thanked 13 Times in 11 Posts
Default freshclam updated script

hey all,

in a previous post somewhere I had a script mentioned which not only auto updates clamav but also checks if there's a new version and downloads/compiles and restarts whatever services.

I have now done it for ISPC if you guys want to try it out. You have to use the crontab option instead of the daemon to do updates as the script does it and also checks for binary updates.

I've done this to mine and so far it appears to work fine. The only time it ever broke was when the mirror no longer hosted it and i got an email notice about it to change the mirror setting.

Parameters needed to set are the ADMIN and the MIRROR variables, the rest are fine.

This beats waiting for a new ISPC to get an update or if your happy to keep your ispc version at least you get binary updates too.
PHP Code:
# Version 1.01 by George Vieira

# place your ISPC admin email address here.

# place your preferred mirror server here.

# -- Nothing to change under this line -----------------------------

        if [ 
"$ADMIN" ]; then
echo "Subject:CLAMUPDATE: $1" sendmail "$ADMIN"
"Subject:CLAMUPDATE: $1" sendmail root

VERSION="`host -t txt current.cvd.clamav.net | sed -e 's/"//g' |cut -d ' ' -f 4|cut -d : -f 1`"
"$?" != ] && ( echo "Error with finding new version off clamav.net site. URL may have changed!";exit 1;)



if [ ! -
/var/log/clam-update.log ]; then
        chown admispconfig 
        chmod 660 

="`/home/admispconfig/ispconfig/tools/clamav/bin/freshclam --log=/var/log/clam-update.log 2>&1`"

NEW="`echo \"$STATUS\" | grep \"WARNING: Local version\" | awk {'print $7'}`"
OLD="`echo \"$STATUS\" | grep \"WARNING: Local version\" | awk {'print $4'}`";
NEWUPDATE="`echo \"$STATUS\" |grep \"Current functionality level\"`"

"$NEWUPDATE" ] && NEW="`findversion`"

# If there's a NEW one, updated it.
if [ "$NEW" ]; then
/root/ispc.updates 2>/dev/null

if [ -"clamav-$OLD" ]; then
-fr "clamav-$OLD"

-c $MIRROR/clamav-$NEW.tar.gz >>$LOG 2>&1

        if [ 
$RESULT ]; then
                tar xvfz clamav
-$NEW.tar.gz >/dev/null 2>&1

./configure --prefix=/home/adm${APPLICATION_NAME}/${APPLICATION_NAME}/tools/clamav 
--with-user=adm${APPLICATION_NAME} --with-group=adm${APPLICATION_NAME
disable-clamav --disable-bzip2 >>$LOG 2>&|| error "Could not configure ClamAV"
make || error "Could not make ClamAV"
make install || error "Could not install ClamAV"
cp -f COPYING /home/adm${APPLICATION_NAME}/${APPLICATION_NAME}/tools/clamav/
cp -f clamav.conf /home/adm${APPLICATION_NAME}/${APPLICATION_NAME}/tools/clamav/etc/clamav.conf
-f freshclam.conf /home/adm${APPLICATION_NAME}/${APPLICATION_NAME}/tools/clamav/etc/freshclam.conf
ln -s clamav.conf clamd.conf

# Bit of a shame we have to restart ALL the ISPC services and not only freshclam
/etc/rc.d/init.d/ispconfig_server restart

"Updated from OLD=$OLD -> NEW=$NEW"
error "Cannot fetch new CLAMAV version, check mirror address"

Last edited by djtremors; 11th December 2006 at 10:54.
Reply With Quote
Sponsored Links


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows PHP script problem richj1232003 Programming/Scripts 1 2nd November 2006 10:01
Ftp User Creation Script pushparaj Programming/Scripts 4 27th September 2006 21:15
Script questions && Gentoo version hagel Feature Requests 4 7th May 2006 14:19
PERL script help... simple issue i think gjcomputer General 3 14th March 2006 10:49
Executing ICON script lawson Programming/Scripts 3 28th December 2005 21:51

All times are GMT +2. The time now is 13:00.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.