Hello,
If you have resellers who are missing domains in the "list accounts" but the domains show up in the bandwidth usage, this script will help you. Just put it in /scripts/rebuildtrueuserowners and then chmod 755 and run it.
All questions/comments welcome. Perhaps this can be included in a cpanel update?
Code:#!/usr/bin/perl # Written by Avi Brender 8/23/2005 # Takes data from /var/cpanel/root.accts and fills in /etc/trueuserowners $file = "/etc/trueuserowners"; open(FILE,"$file") || die "ERROR: Cant open $file: $!"; @lines = <FILE>; foreach $line (@lines){ chomp $line; ($user,$owner) = split(/: /,$line); $done{$user}=1; } close(FILE); open(ROOT,"/var/cpanel/root.accts") || die "ERROR: Can't open /var/cpanel/root.accts: $!"; @lines = <ROOT>; foreach $line (@lines){ @parts = split(/\,/,$line); $user = $parts[3]; $owner = $parts[12]; if ($done{$user}){print "Skipping $user - already exists (owner: $owner)\n";} else { print "ADDING user $user (owner: $owner)\n"; open(FILE,">>$file") || die "ERROR: Can't open $file for writing: $!"; print FILE "$user\: $owner\n"; close(FILE); } } close(ROOT);



LinkBack URL
About LinkBacks
Reply With Quote




