File: //proc/self/root/scripts.20110531.215904.25158/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";