MOON
Server: Apache
System: Linux vps.thepromohut.com 2.6.18-398.el5 #1 SMP Tue Sep 16 20:51:48 EDT 2014 i686
User: caretrak (507)
PHP: 5.2.10
Disabled: NONE
Upload Files
File: //scripts.20110601.041516.15411/exchangeacctdb
#!/usr/bin/perl

open(CONF,"/etc/wwwacct.conf") || die "/etc/wwwacct.conf not found\n";
while(<CONF>) {
        $_ =~ s/\n//g;
        if ($_ !~ /^;/) {
                if ($_ =~ /BILLMASTER/) {
                        (undef,$billmaster) = split(/ /, $_);
                }
	}
}

if ($billmaster eq "") { exit; }

chomp($hostname = `hostname`);

opendir(PKGS,"/var/cpanel/packages");
@PKGS=readdir(PKGS);
closedir(PKGS);

@PKGS=grep(!/^\./, @PKGS);


open(PKGLIST,">/var/cpanel/pkglist.db");
foreach $pkg (@PKGS) {
	print PKGLIST $pkg . "\n";
}
close(PKGLIST);

system("scp -o \"Protocol 1,2\" -q /var/cpanel/accts.db root\@${billmaster}:/var/cpanel/billing/${hostname}-accts.db");
system("scp -o \"Protocol 1,2\" -q /var/cpanel/pkglist.db root\@${billmaster}:/var/cpanel/billing/${hostname}.pkglist");

print "Billing Data Exchange completed\n";