Wednesday, January 16, 2008

Update trueuserdomain and userdomains in cpanel

Hi All,

Script to create userdomains and trueuserdomains in a cpanel server from /var/cpanel/users.

Put the following code in the vi /root/domains.sh
change the permission to execute the script. chmod 700 /root/domains.sh


#!/bin/sh
if [ -d /root/supportpro/ ]; then
cd /root/supportpro/
else
mkdir /root/supportpro/
cd /root/supportpro/
fi
echo > /root/supportpro/alldomainlist
echo > /root/supportpro/domainlist
echo > /root/supportpro/trueuserdomains
echo > /root/supportpro/userdomains
grep DNS /var/cpanel/users/* > /root/supportpro/alldomainlist
cat /root/supportpro/alldomainlist|\
while read line
do
echo `echo $line | awk -F = {'print $2'}`: `echo $line | awk -F : {'print $1'} | awk -F / {'print $5'}` >> /root/supportpro/userdomains
done
grep DNS= /var/cpanel/users/* > /root/supportpro/domainlist
cat /root/supportpro/domainlist|\
while read line
do
echo `echo $line | awk -F = {'print $2'}`: `echo $line | awk -F : {'print $1'} | awk -F / {'print $5'}` >> /root/supportpro/trueuserdomains
done

1 comment:

Angitha said...

nice blog... its really helpful one :) I have a doubt but, can't we use /scripts/updateuserdomains or /usr/local/cpanel/bin/userdata_update for the same purpose?