View Single Post
  #7  
Old 16th November 2008, 12:16
SupuS SupuS is offline
HowtoForge Supporter
 
Join Date: May 2006
Posts: 201
Thanks: 68
Thanked 13 Times in 11 Posts
Default

I finally solved problem with "unmatch quotas and du -su".

For reset quotas I used command:

Code:
quotacheck -avugmc
But it reseted all quotas for all webs. Now I created little script for update all quotas. Falko or Till check it please for bugs. It works for me.

Here is the script (part of writeconf.php)

PHP Code:
<?php

set_time_limit
(0);
// ĂberprĂźfung, ob parallel noch ein anderer ProzeĂ läuft
if(is_file("/root/ispconfig/.ispconfig_lock")){
  
clearstatcache();
  for(
$i=0;$i<120;$i++){ // max. 120 Sek. warten, dann weitermachen
    
if(is_file("/root/ispconfig/.ispconfig_lock")){
      
sleep(1);
      
clearstatcache();
    }
  }
}

@
touch("/root/ispconfig/.ispconfig_lock");

include(
"/root/ispconfig/scripts/lib/config.inc.php");
include(
"/root/ispconfig/scripts/lib/config.lib.php");
include(
"/root/ispconfig/scripts/lib/server.inc.php");

$isp_web = new isp_web;

echo 
"start\n";

/////////////// Web- u. Userdaten aus DB holen ////////////////
$w_ds $mod->db->queryAllRecords("SELECT * FROM isp_isp_web");
if(!empty(
$w_ds)){
  foreach(
$w_ds as $w_d){
    
$mod->system->data["isp_isp_web"][$w_d["doc_id"]] = $w_d;
  }
}

$u_ds $mod->db->queryAllRecords("SELECT * FROM isp_isp_user");
if(!empty(
$u_ds)){
  foreach(
$u_ds as $u_d){
    
$mod->system->data["isp_isp_user"][$u_d["doc_id"]] = $u_d;
  }
}

$mod->system->data["isp_server_ip"] = $mod->db->queryAllRecords("SELECT * FROM isp_server_ip WHERE server_id = '".$mod->system->server_id."' AND server_ip != ''");
////////////////////////////////////////////////////////////////

/* here I changed isp_isp_web.status = 'u' to isp_isp_web.status = '' so all webs will be updated */

$web_update $mod->db->queryAllRecords("SELECT * from isp_isp_web, isp_nodes where isp_isp_web.doc_id = isp_nodes.doc_id and isp_nodes.doctype_id = '".$isp_web->web_doctype_id."' and isp_isp_web.status = '' and isp_isp_web.server_id = '".$mod->system->server_id."' and isp_nodes.status = '1'");
$web_update_ssl_action 0;
if(!empty(
$web_update)){
  foreach(
$web_update as $web) {
    
$doc_id $web["doc_id"];
    
$doctype_id $web["doctype_id"];
    
$isp_web->web_update($doc_id,$doctype_id,$mod->system->server_id);
    echo 
"UPDATE: ".$doc_id."\n";
    if(
$web["ssl_action"] != ''$web_update_ssl_action += 1;
  }
}

// Webs und User endgĂźltig lĂśschen
$isp_web->web_user_clean();

echo 
"ende\n";

// lock-Datei lĂśschen
@unlink("/root/ispconfig/.ispconfig_lock");

?>
If somebody wants to use it please backup first and be carefully. It works for me but I didn't tested it very well yet.

For run this script simply save it and run by:

Code:
/root/ispconfig/php/php /path/to/new/script.php
Hope it helps somebody
Reply With Quote