The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Domains not showing in resellers account list

Discussion in 'General Discussion' started by abrender, Aug 24, 2005.

  1. abrender

    abrender Active Member

    Joined:
    Dec 5, 2002
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    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);
    
     
Loading...

Share This Page