Exemplo n.º 1
0
include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . "/framework/frame.class.inc";
if ($argv[1] == "--sizes-backup") {
    sizes_backup();
    die;
}
if ($argv[1] == "--exec") {
    start();
    die;
}
if ($argv[1] == "--dirs") {
    ScanDirs();
    die;
}
if ($argv[1] == "--remove-dirs") {
    RemoveDirs();
    die;
}
if ($argv[1] == "--ftp") {
    ftp_backup();
    die;
}
if ($argv[1] == "--export") {
    ExportSingleWebsite($argv[2]);
    die;
}
if ($argv[1] == "--import") {
    ImportSingleWebsite($argv[2]);
    die;
}
function start()
Exemplo n.º 2
0
function Clean_dirs()
{
    $sock = new sockets();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $TimeFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "TimeFile:{$TimeFile}\n";
    }
    $unix = new unix();
    $me = basename(__FILE__);
    if ($unix->process_exists(@file_get_contents($pidfile), $me)) {
        if ($GLOBALS["VERBOSE"]) {
            echo " --> Already executed.. " . @file_get_contents($pidfile) . " aborting the process\n";
        }
        system_admin_events("--> Already executed.. " . @file_get_contents($pidfile) . " aborting the process", __FUNCTION__, __FILE__, __LINE__, "zarafa");
        die;
    }
    @file_put_contents($pidfile, getmypid());
    $TimeFileEx = $unix->file_time_min($TimeFile);
    if (!$GLOBALS["FORCE"]) {
        if ($TimeFileEx < 1440) {
            return;
        }
    }
    @unlink($TimeFile);
    @file_put_contents($TimeFile, time());
    ScanDirs();
    RemoveDirs();
}