Esempio n. 1
0
function restart($nopid = false)
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    if (!$nopid) {
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
    }
    @file_put_contents($pidfile, getmypid());
    stop(true);
    $LIGHTTPD_CONF_PATH = LIGHTTPD_CONF_PATH();
    @mkdir("/var/run/lighttpd", 0755, true);
    $roundcube = new roundcube();
    if ($GLOBALS["OUTPUT"]) {
        echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Building MySQL Path {$roundcube->root_path}\n";
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Building MySQL config\n";
    }
    $roundcube->db_inc_php();
    @file_put_contents("{$roundcube->root_path}/config/main.inc.php", $roundcube->RoundCubeConfig());
    verifyTables();
    start(true);
}
Esempio n. 2
0
    die;
}
if ($argv[1] == "--contextmenu") {
    plugin_contextmenu();
    die;
}
if ($argv[1] == "--build") {
    build();
    die;
}
if ($argv[1] == "--addressbook") {
    plugin_globaladdressbook();
    die;
}
if ($argv[1] == "--verifyTables") {
    verifyTables();
    die;
}
if ($argv[1] == "--hacks") {
    RoundCubeHacks();
    die;
}
if ($argv[1] == "--tableslist") {
    RoundCubeMysqlTablesList();
    die;
}
if (!$_GLOBAL["roundcube_installed"]) {
    die("Roundcube is not installed, aborting");
}
$pid = getmypid();
$pidfile = "/etc/artica-postfix/" . basename(__FILE__) . ".pid";
Esempio n. 3
0
include_once(dirname(__FILE__) . '/framework/class.unix.inc');
include_once(dirname(__FILE__) . '/framework/frame.class.inc');

if(preg_match("#--verbose#",implode(" ",$argv))){$GLOBALS["VERBOSE"]=true;}
if($GLOBALS["VERBOSE"]){ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);}
$bd="roundcubemail";
$GLOBALS["MYSQL_DB"]=$bd;	


if($argv[1]=="--sieverules"){plugin_sieverules();die();}
if($argv[1]=="--calendar"){plugin_calendar();die();}
if($argv[1]=="--database"){check_databases($bd);die();}
if($argv[1]=="--contextmenu"){plugin_contextmenu();die();}
if($argv[1]=="--build"){build();die();}
if($argv[1]=="--addressbook"){plugin_globaladdressbook();die();}
if($argv[1]=="--verifyTables"){verifyTables();die();}
if($argv[1]=="--hacks"){RoundCubeHacks();die();}
if($argv[1]=="--tableslist"){RoundCubeMysqlTablesList();die();}





if(!$_GLOBAL["roundcube_installed"]){die("Roundcube is not installed, aborting");}

$pid=getmypid();
$pidfile="/etc/artica-postfix/".basename(__FILE__).".pid";

$unix=new unix();
if($unix->process_exists($pid)){die();}
@file_put_contents($pidfile,$pid);