squiggerz

Registered
Apr 15, 2007
1
0
151
Alright, I have 3 separate hosting accounts, all from the same provider, each running around 60 sites on average. I've been hacking away (no, not code hacking, just hacking it to death) at this php script I found on cputils.com that allows you to view disk usage from cPanel for all accounts. What I am trying to do is use this script to take the disk usage for all accounts on the hosting plan, have a backup script (also hacked to death and found at the same site) schedule backups according to size of site and automate it over the 7 day week from 6pm to 8am the next day.

My question is, does this idea even sound feasible?

My other option is to just have the script download all the backups in the WHM when called.

I have read over the 'smarter backup script' located on this site, which sounded exactly like what I am trying to do. Only problem is, I cant access the site via a shell, or at least thats what my limited experience leads me to believe.

I have access to a Debian box however, if there might be some way for me to access this server through it and use that smarter script via my debian installation, if anybody here has the free time to explain even a fraction of what would be necessary to get this show on the road I would greatly appreciate any help you could offer.

Now, can somebody help me with this php issue??

<?php
$whmUser = '*****';
$whmPass = '*****';
$cpUser = '*****';
$cpPass = '*****';
$url = 'www.*****.com';
$cpTheme = 'rvblue';
$msg = 'Timestamp: '.date("F j, Y, g:i a")."\n\n";
//get WHM list accounts
$page2 = @file_get_contents("http://$whmUser:[email protected]$url:2086/scripts2/listaccts?viewall=1",'r');
//get each account table row
$int2 = preg_match_all("/<tr class=(?:tdshade2|tdshade1)>(.*?)<\/tr>/is", $page2, $matches);

if($int2 >= 0 && is_array($matches[1])) {
foreach($matches[1] as $match) {
$account = explode('</td><td>',$match);
$msg .= 'Domain: '.strip_tags($account[0]).' -- Space used: '.$account[0]."\n";
echo $match[1];
}
echo "IF is true, but foreach not working";
}
else {
$msg .= "\n<br>Error<br>\n";
echo $msg;
}
?>

Hopefully somebody else can see what I am not. I'm an extremely green php kiddie at the moment, but I'm guessing something has to be going wrong in the preg_match_all function... anybody??