예제 #1
0
function fixlogdir_main()
{
    global $gbl, $sgbl, $login, $ghtml;
    $progname = $sgbl->__var_program_name;
    $logl = lscandir_without_dot("../log");
    lxfile_mkdir("../processed_log");
    @lunlink("../log/access_log");
    @lunlink("/usr/local/lxlabs/ext/php/error.log");
    $dir = getNotexistingFile("../processed_log", "proccessed");
    system("mv ../log ../processed_log/{$dir}");
    mkdir("../log");
    $list = lscandir_without_dot("../processed_log");
    foreach ($list as $l) {
        remove_directory_if_older_than_a_day("../processed_log/{$l}", 6);
    }
    foreach ($logl as $l) {
        lxfile_touch("../log/{$l}");
    }
    lxfile_generic_chown_rec("../log", "lxlabs:lxlabs");
    //
    // Related to Issue #15
    //
    lxfile_generic_chmod_rec("../log", "0640");
    lxfile_generic_chmod_rec("../processed_log", "0640");
    lxfile_generic_chmod("../log", "0700");
    lxfile_generic_chmod("../processed_log", "0700");
    lxfile_generic_chmod("../log/lighttpd_error.log", "0644");
    lxfile_generic_chmod("../log/access_log", "0644");
    lxfile_generic_chown("../log/lighttpd_error.log", "lxlabs:root");
    lxfile_generic_chown("../log/access_log", "lxlabs:root");
    //
    os_restart_program();
}
예제 #2
0
function updatecleanup()
{
    global $gbl, $sgbl, $login, $ghtml;
    print "Checking program service\n";
    os_create_program_service();
    print "Checking permissions\n";
    os_fix_lxlabs_permission();
    print "Restart myself\n";
    os_restart_program();
    print "Start Some cleanups:\n";
    updateApplicableToSlaveToo();
}
예제 #3
0
function cleanupUpdate()
{
    global $gbl, $sgbl, $login, $ghtml;
    $prognameNice = $sgbl->__var_program_name_nice;
    print "Checking {$prognameNice} service\n";
    os_create_program_service();
    print "Checking {$prognameNice} permissions\n";
    os_fix_lxlabs_permission();
    print "Restart {$prognameNice}\n";
    os_restart_program();
    print "Start {$prognameNice} cleanups\n";
    cleanupProcess();
}
예제 #4
0
function check_for_remote($rmt)
{
    global $gbl, $sgbl, $login, $ghtml;
    $local = false;
    $res = new Remote();
    $res->exception = null;
    if (!$rmt->authenticated) {
        $local = true;
        if (!($rmt->password === getAdminDbPass())) {
            log_message("Failed Local access to {$rmt->remote_login} from localhost");
            $res->exception = new lxException("login_failed", $rmt->machine);
            return $res;
        }
    }
    if (!$local) {
        log_message("Successful Access access to {$rmt->remote_login} from {$rmt->machine}");
    }
    $vercmp = version_cmp($rmt->version, $sgbl->__ver_major_minor_release);
    if ($local) {
        if ($vercmp > 0) {
            $res->exception = new lxException("backend_server_restarting", $rmt->machine);
            os_restart_program();
            return $res;
        }
    }
    //dprintr($rmt);
    /* Even if it is demo, versions must be updated, otherwise, results are unpredictable.
    	if (if_demo()) {
    		do_the_action($rmt, $res);
    
    		$res->state = 'success';
    		return $res;
    	}
    */
    if ($vercmp < 0) {
        $res->state = 'version_greater';
        print "Version Greater <br> \n";
        $res->exception = new lxException("slave_version_higher._please_update_master_to_the_latest_version", $rmt->machine);
        return $res;
    }
    if ($vercmp > 0) {
        update_from_master($rmt);
        //$res->state = 'upgrade';
        $res->exception = new lxException("slave_upgrading_please_try_after_a_few_minutes", 'machine', $rmt->machine);
        print "Version Lesser <br> \n";
        return $res;
    }
    do_the_action($rmt, $res);
    $res->state = 'success';
    return $res;
}
예제 #5
0
파일: lib.php 프로젝트: zseand/kloxo
function setPrepareKloxo()
{
    log_cleanup("Prepare for Kloxo");
    log_cleanup("- OS Create Kloxo init.d service file and copy core php.ini (lxphp)");
    os_create_program_service();
    log_cleanup("- OS Fix programroot path permissions");
    os_fix_lxlabs_permission();
    log_cleanup("- OS Restart Kloxo service");
    os_restart_program();
}