
Originally Posted by
bvierra
The main reason this script was written was to help admins keep track of domains that still pointed to a server that they where trying to move accounts off of. This script was also found useful because it helped find mistakes. Some sales/admins forget to remove accounts of canceled customers. Basically this script scans thru a db file and resolves each domain and makes sure it points to the correct ip. If it does not point to the right ip then it will let you know.
http://cplicensing.net/scripts.php?file=chkcpaccts
We overhauled the fetchcsv function in cPanel 11.25. The data it returns now contains a header row. Plus every column in the List Accounts interface is represented in the csv file.
The script billy links to is not aware of these changes. For cPanel 11.25 servers replace this:
Code:
print "Retreiving CSV from whostmgr...";
my %csv;
foreach(qx(/usr/local/cpanel/whostmgr/bin/whostmgr fetchcsv)) {
chomp;
next unless /^,/;
my(undef,$domain,$ip,$user,undef) = split(",", $_, 5);
next unless $domain and $ip and $user;
$ip =~ s/:443//;
$csv{$user}{domain} = $domain;
$csv{$user}{ip} = $ip;
}
print "Success\n";
with
Code:
print "Retreiving CSV from whostmgr...";
my %csv;
my @dataset = qx( /usr/local/cpanel/whostmgr/bin/whostmgr fetchcsv );
foreach my $record ( @dataset) {
chomp $record;
next unless $record =~ /,/;
#Domain,IP,User Name,Email,Start Date,Disk Partition,Quota,Disk Space Used,Package,Theme,Owner,Server,Unix Startdate,Disk Space Used (bytes),Quota (bytes)
my($domain,$ip,$user, undef) = split(",", $record, 4);
next if $domain eq 'Domain'; # skip header row
next unless $domain and $ip and $user;
$ip =~ s/:443//;
$csv{$user}{'domain'} = $domain;
$csv{$user}{'ip'} = $ip;
}
print "Success\n";
Please note that neither I nor cPanel take any responsibility for the use of the script. Nor are any guarantees made regarding the quality of the original script or the continuing compatibility of the script or proposed code changes.