1#! /usr/bin/env php
2<?php
3// This file is part of BOINC.
4// http://boinc.berkeley.edu
5// Copyright (C) 2008 University of California
6//
7// BOINC is free software; you can redistribute it and/or modify it
8// under the terms of the GNU Lesser General Public License
9// as published by the Free Software Foundation,
10// either version 3 of the License, or (at your option) any later version.
11//
12// BOINC is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15// See the GNU Lesser General Public License for more details.
16//
17// You should have received a copy of the GNU Lesser General Public License
18// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
19
20$cli_only = true;
21require_once("../inc/cache.inc");
22require_once("../inc/util_ops.inc");
23
24set_time_limit(0);
25
26function cache_check_diskspace2(){
27   $too_old = 86400;
28   while (1) {
29       $f = disk_free_space("../cache");
30       $u = disk_usage("../cache");
31       echo "free: $f used: $u\n";
32       if ($f > MIN_FREE_SPACE && $u < MAX_CACHE_USAGE) {
33           break;
34       }
35       clean_cache($too_old, "../cache");
36       $too_old/=2;
37   }
38}
39
40cache_check_diskspace2();
41?>
42