Leaderboard (728 x 90)

Sunday, February 26, 2012

how to set default proxy server for linux

In file ~/.bash_profile, add this line.

http_proxy=[proxy_server:port]
ftp_proxy=[proxy_server:port]
export http_proxy
export ftp_proxy

how to set proxy for yum

In file /etc/yum.conf, add this line.

proxy=[proxy_server:port]
proxy_username=[proxy_username]
proxy_password=[password]

how to set proxy server for wget

In file /etc/wgetrc, edit this line.

http_proxy=[proxy_server:port]
ftp_proxy=[proxy_server:port]

Saturday, February 4, 2012

init: Id "x" respawning too fast: disabled for 5 minutes


In most Linux distributions this means that the system is booting by default into runlevel 5, which is supposed to respawn (re-start again after it’s been exited) a gui login via x windows, kdm, gdm, or whatever, but the system can’t locate the program. As a result below logs will keep appearing on your /var/log/messages for every 5 minutes.

Feb 4 08:55:25 server init: Id "x" respawning too fast: disabled for 5 minutes

However, “Id” can also indicate the absence or misconfiguration of another program, like mingetty, if init tries to respawn itself more than 10 times in 2 minutes.

Reason: You remove the “X Window System” and “GNOME Desktop Environment” but never modified the /etc/inittab.

Solution:

vi /etc/inittab

Change the initdefault id to 3 as below:

id:3:initdefault:

save and reboot your system


Or you may need to reinstall the “X Window System” and “GNOME Desktop Environment”.

yum groupinstall "X Window System"
yum groupinstall "GNOME Desktop Environment"

Clean up cache and log for magento


Create cleanup.php file in document root folder then put these code to it, edit database variables, save and run cleanup.php?clean=log or cleanup.php?clean=var


<?
$db['host'] = '';                    // Database hostname
$db['name'] = '';                    // Database name
$db['user'] = '';                    // Database username
$db['pass'] = '';                    // Database password
$db['pref'] = '';                    // Database tables' prefix

if($_GET['clean'] == 'log') clean_log_tables();
if($_GET['clean'] == 'var') clean_var_directory();

function clean_log_tables() {
    global $db;
 
    $tables = array(
        'log_url',
        'log_url_info',
        'log_visitor',
        'log_visitor_info'
    );
 
    mysql_connect($db['host'], $db['user'], $db['pass']) or die(mysql_error());
    mysql_select_db($db['name']) or die(mysql_error());
 
    foreach($tables as $v => $k) {
        mysql_query('TRUNCATE `'.$db['pref'].$k.'`') or die(mysql_error());
    }
}

function clean_var_directory() {
    $dirs = array(
        'var/cache/',
        'var/log/',
        'var/report/',
        'var/session/',
        'var/tmp/',
        'downloader/pearlib/cache/*',
        'downloader/pearlib/download/*'
    );
 
    foreach($dirs as $v => $k) {
        exec('rm -rf '.$k);
    }
}
?>



Reference: http://www.magentocommerce.com/boards/viewthread/36148/#t117754