Install clamavconnector (cpanel addon) from SSH

I avoid logging into WHM whenever possible, relying on ssh, and normally cpanel as script or command so WHM can be avoided. I’ve been looking around for a way to install clamavconnector with out logging into WHM and enabling it in the addons section. Unfortunatly there is no script to do this with cpanel. However after enabling it a few times in WHM, I was able to write my own script to do this.

The script is below, if the plugin is installed already the update addon WHM script is called. This has been tested in i686 and x86_64 only.

[code]
#!/bin/bash

# small sanity checks
if [ ! -e /etc/redhat-release ]; then
echo ‘Tested on rhel only’;
exit;
fi

if [ ! -e /usr/local/cpanel ]; then
echo ‘Requires cpanel’;
exit;
fi

#make dir if it doesn’t exist
mkdir -p /usr/local/cpanel/modules-install
cd /usr/local/cpanel/modules-install

# supports i686 and x86_64
arch=`uname -m`;

if [ ! -d clamavconnector-Linux-${arch} ]; then
if [ -f clamavconnector-Linux-${arch}.tar.bz2 ]; then
/bin/rm clamavconnector-Linux-${arch}.tar.bz2
fi
wget http://httpupdate.cpanel.net/cpanelsync/addons/modules/clamavconnector-Linux-${arch}.tar.bz2
if [ -e clamavconnector-Linux-${arch}.tar.bz2 ]; then
tar -jxvf clamavconnector-Linux-${arch}.tar.bz2
rm clamavconnector-Linux-${arch}.tar.bz2
cd clamavconnector-Linux-${arch}
./install
fi
else
echo “clamav installed already, updating”;
/usr/local/cpanel/whostmgr/bin/whostmgr2 –updateaddons
fi

[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *