Move Windows with screen

May 13th, 2010
  • change to the window you want to move
  • type (for example) ^a:number 1
  • ^x is the host key (usually ^a on most machines)  (CTRL+A)
  • :number (typed literally) is the command
  • 1 the number to move the current screen to

Error compiling PHP on CentOS 64 bit

April 23rd, 2010

In order to compile PHP on 64 bit you need to use the option --with-libdir=lib64 otherwise you will stay forever with the following error

checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for more information.

Other possible reasons are :
1. missing the libtool-ltdl-devel package
2. missing the ncurses-devel
3. missing mysql-devel package

/usr/bin/ld: cannot find -lltdl

April 23rd, 2010

yum install libtool-ltdl.x86_64 libtool-ltdl-devel.x86_64

TCP: too many of orphaned sockets

April 23rd, 2010

The tcp_max_orphans variable tells the kernel how many TCP sockets that are not attached to any user file handle to maintain. In case this number is exceeded, orphaned connections are immediately reset and a warning is printed.

The only reason for this limit to exist is to prevent some simple DoS attacks. Generally you should not rely on this limit, nor should you lower it artificially. If need be, you should instead increase this limit if your network environment requires such an update. Increasing this limit may require that you get more memory installed to your system. If you hit this limit, you may also tune your network services a little bit to linger and kill sockets in this state more aggressively.

This variable takes an integer value and is per default set to 8192, but heavily depends upon how much memory you have. Each orphan that currently lives eats up 64Kb of unswappable memory, which means that one hell of a lot of data will be used up if problems arise.

Note If you run into this limit, you will get an error message via the syslog facility kern.info that looks something like this:

TCP: too many of orphaned sockets

If this shows up, either upgrade the box in question or look closer at the tcp_fin_timeout or tcp_orphans_retries which should give you some help with getting rid of huge amounts of orphaned sockets.

Plesk Qmail issue regarding /etc/courier-imap/shared/index

April 20th, 2010

If you see in your logs:
Jun 4 16:11:18 host imapd: /etc/courier-imap/shared/index: No such file or directory

you need to check perms and ownership on /var/qmail/bin/qmail-queue

# ls -la /var/qmail/bin/qmail-queue
-r-s–x–x 1 root qmail 25828 Apr 26 15:20 /var/qmail/bin/qmail-queue
perms are fine, but ownership is not
# chown qmailq:qmail /var/qmail/bin/qmail-queue
# ls -la /var/qmail/bin/qmail-queue
-r-x–x–x 1 qmailq qmail 25828 Apr 26 15:20 /var/qmail/bin/qmail-queue
[root@host ~]# service qmail restart
Stopping : Starting qmail:

Install Squid 3.1 on Centos 5.X

February 28th, 2010

yum -y groupinstall “Development Tools”
yum -y install rpm-build openjade linuxdoc-tools openldap-devel pam-devel openssl-devel httpd rpm-devel expat-devel db4-devel libpcap-devel

For Centos : rpm -ihv http://www.jur-linux.com/rpms/el-updates/5Client/SRPMS/squid-3.1.0.15-2.el5.src.rpm
For Fedora : rpm -ihv http://www.jur-linux.com/rpms/el-updates/5Client/SRPMS/squid-3.1.0.15-2.fc13.src.rpm

cd /usr/src/redhat/SPECS
rpmbuild -bb squid.spec
rpm -Uhv /usr/src/redhat/RPMS/i386/squid-3.1.0.15-2.i386.rpm

Howto show email accounts and passwords in Plesk

October 4th, 2009

Login to mysql and :

use psa;
SELECT accounts.id, mail.mail_name, accounts.password, domains.name FROM domains LEFT JOIN mail ON domains.id = mail.dom_id LEFT JOIN accounts ON mail.account_id = accounts.id

It should print all emails that are created and their passwords.

Add swap on Linux

October 1st, 2009

[root@host ~]# dd if=/dev/zero of=/swapfile bs=1024 count=1048576
1048576+0 records in
1048576+0 records out
[root@host ~]# sync
[root@host ~]# mkswap /swapfile
Setting up swapspace version 1, size = 1073737 kB
[root@host ~]# swapon /swapfile
[root@host ~]# echo “/swapfile swap swap defaults 0 0″ >> /etc/fstab

Howto list installed packages sorted by size

October 1st, 2009

rpm -qa –queryformat ‘%{SIZE} %{NAME} %{VENDOR}\n’ | sort -n -r | head -10

Check :rpm –querytags for all the tags

Script to generate /etc/network/interfaces file on Ubuntu/Debian

September 30th, 2009

#!/bin/bash
ifile=/etc/network/interfaces
echo -n “Insert IPstart:”
read ipstart
echo -n “Insert IPend:”
read ipend
echo -n “Insert Gateway:”
read gw
#echo -n “Insert Subnet: ”
#read subnet
echo -n “Insert Netmask: ”
read net
echo -n “Insert aliast to start: ”
read ali

firstIp=`echo “${ipstart%.*}”`
lastIpStart=`echo “${ipstart##*.}”`
lastIpEnd=`echo “${ipend##*.}”`
dif=`echo $(($lastIpEnd-$lastIpStart))`

ip=$lastIpStart
for ((i=$ali;i<=$ali+$dif;i++)){
echo "auto eth0:$i" >>$ifile
echo “iface eth0:$i inet static” >>$ifile
echo “address $firstIp.$ip” >>$ifile
echo “network $subnet” >>$ifile
echo “netmask $net” >>$ifile
echo “gateway $gw” >> $ifile
echo ” ” >> $ifile
let ip++
}