Archive for February, 2010

Solution

This example will change the ethernet device with name dev12345 to eth0 and assumes eth0 currently does not exist.
Down the device before changing any files with the command # ifdown dev12345. Also remove the kernel module which is
referenced against this device in the /etc/modprobe.conf. In this example there is a line which has “alias dev12345
e1000
“, so perform “#rmmod e1000“. It may also be necessary to run “#ifdown ” on any other network devices using this
kernel module. If this step is skipped it may be necessary to undo any file name changes including setting up the
ifcfg-dev12345 file as mentioned below.
Modify the file /etc/sysconfig/hwconf replacing ifcfg-dev12345 with ifcfg-eth0. If this file doesn’t exist ignore this
step as this file is simply a generated file from the Red Hat Enterprise Linux installation program:
class: NETWORK
bus: PCI
detached: 0
device: eth0

Modify the file /etc/modprobe.conf replacing ifcfg-dev12345 with ifcfg-eth0:
alias eth0 e1000
In the directory /etc/sysconfig/network-scripts/ rename the file ifcfg-dev12345 to ifcfg-eth0. Edit this file replacing
ifcfg-dev12345 with ifcfg-eth0:
DEVICE=eth0
If the system-config-network* tools were used, it may be necessary to remove any file referencing the old device in the
/etc/sysconfig/networking directory. ie.
# find /etc/sysconfig/networking -name ifcfg-dev12345
/etc/sysconfig/networking/profiles/default/ifcfg-dev12345
/etc/sysconfig/networking/devices/ifcfg-dev12345
# rm /etc/sysconfig/networking/profiles/default/ifcfg-dev12345
# rm /etc/sysconfig/networking/devices/ifcfg-dev12345
At this stage it is now possible to up eth0 with the command # ifup eth0.

rpm -iv –replacepkgs httpd-2.2.3-5.i386.rpm

Ever want to immediatly serve content from a specific directory over HTTP, but didn’t want to bother messing with
httpd.conf or other webserver configiurations?

If you’ve got Python installed, this is a snap. Execute python with the SimpleHTTPServer module, using port 8080 so
there isn’t a need to elevate privs to root.

$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 …

or python3 -m http.server 8080

Sure enough, pointing a browser to the IP address :8080 of the box hits my home directory listing. Super easy, super
fast, super simple!

I use this to serve content to my PS3. The PS3 doesn’t support NFS or CIFS, so to download content to the hard drive,
the best method is by pulling it over HTTP with the embedded web brower. On my MacBook, I change into the directory
containing whatever media I want to transfer, fire up HTTP, and suck it down to the hard drive on the PS3. Nice!

source: http://prefetch.net/blog/index.php/2009/10/31/serve-out-content-over-http-from-your-cwd-immediatly/

c ~ $ strace -f -s 128 $(pidof httpd |sed 's/\([0-9]*\)/\-p \1/g')

Quite simple really, just use sed to make the necessary command line switches.

strace wants to have the PIDs passed one per '-p' switch. It would be nice to have a -p 3434,4565,4342 option but oh
well. sed with a easy replace handles all that's necessary.

Observe the output of pidof

c ~ $ pidof httpd
9629 9439 9428 9427 9426 9425 9424 9420

Wrap with sed to create multiple -p switches.

c ~ $ pidof httpd |sed 's/\([0-9]*\)/\-p \1/g'
-p 9629 -p 9439 -p 9428 -p 9427 -p 9426 -p 9425 -p 9424 -p 9420

Now combine with strace.

c ~ $ strace $(pidof httpd |sed 's/\([0-9]*\)/\-p \1/g')
carbon share # strace $(pidof apache2 |sed 's/\([0-9]*\)/\-p \1/g')
Process 9629 attached - interrupt to quit
Process 9439 attached - interrupt to quit
Process 9428 attached - interrupt to quit
Process 9427 attached - interrupt to quit
Process 9426 attached - interrupt to quit
Process 9425 attached - interrupt to quit
Process 9424 attached - interrupt to quit
Process 9420 attached - interrupt to quit
[pid 9439] semop(10846209, 0xb7bd9a28, 1
[pid 9629] semop(10846209, 0xb7bd9a28, 1
[pid 9428] epoll_wait(10,
[pid 9427] semop(10846209, 0xb7bd9a28, 1
[pid 9426] semop(10846209, 0xb7bd9a28, 1
[pid 9424] semop(10846209, 0xb7bd9a28, 1
[pid 9420] select(0, NULL, NULL, NULL, {0, 730000}
[pid 9425] semop(10846209, 0xb7bd9a28, 1
[pid 9420] <... select resumed> ) = 0 (Timeout)
[pid 9420] waitpid(-1, 0xbff91918, WNOHANG|WSTOPPED) = 0
[pid 9420] select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)

Now go debug some PHP or CGI application in the guts

Source: http://edoceo.com/exemplar/strace-multiple-processes

LDAP server is not responding, database looks corrupted.
Article ID: 5476
Last Review: Feb,9 2009
Author: Vitaly Filatov
Last updated by: Vitaly Filatov APPLIES TO:

* Parallels Operations Automation

Symptoms
LDAP server can be started, but it is not listening on port 389 and is not working, ‘slapcat’ hangs too.
Cause
LDAP back-end database is corrupted.
Resolution
Use slapd_db_recover to recover the database, for example:
[root@psaldap ldap]# slapd_db_recover -v -h /var/lib/ldap
db_recover: Finding last valid log LSN: file: 1 offset 263805
db_recover: Recovery starting from [1][261683]
db_recover: Recovery complete at Thu Jul 17 08:29:23 2008
db_recover: Maximum transaction ID 80000175 Recovery checkpoint [1][264861]

WARNING: Always backup database files before working the database, for standard install files are located in
/var/lib/ldap

Problem

In some environments, administrators may find it difficult or tedious to manage and/or monitor logs from many different
servers, and require a mechanism for directing logs from all systems to one central location. Also, in some situations
when there is an issue with the / or /var filesystem, redirecting logs to another server can allow important messages
critical to troubleshooting to be printed, whereas they would have been lost if syslog was directing them to the local
filesystem.

Solution

The syslogd daemon can be configured to send messages for all logging levels or individual levels to one or more syslog
servers. In order to accomplish this, the file /etc/sysconfig/syslog must be edited on the syslog server to allow
remote machines to send logs here. Add the -r option to the SYSLOGD_OPTIONS like so:

SYSLOGD_OPTIONS="-r -m 0"

After the file has been saved, the syslogd service needs to be restarted:

# service syslog restart

To configure a client to send all messages to the remote server, append the following to /etc/syslog.conf:

*.* @hostname

Replace hostname above with the IP address or the hostname of the centralized log server. Or to only send individual
logging levels to the remote server:

*.info;mail.none;authpriv.none;cron.none @hostname

Again replacing hostname with the IP address or hostname of the remote server. Now restart the syslog service on the
client:

# service syslog restart

The new configuration can be tested by restarting a service such as cups on the client:

# service cups restart

Or by using a command such as:

# logger "***** THIS IS A TEST *****"

The log messages related to the cups service being restarted or from the logger command should be found in
/var/log/messages of the central server.

How can I determine the architecture of my Red Hat Enterprise Linux system?

Environment

Red Hat Enterprise Linux 5
Red Hat Enterprise Linux 4

Resolution

Red Hat Enterprise Linux is available for various 32-bit and 64-bit platforms.

There are two methods to determine what architecture of Red Hat Enterprise Linux you are running.

1) The output of “uname -a

Example output on a 32-bit system:

Linux my32bitsystem 2.6.18-53.1.4.el5 #1 SMP Wed Nov 14 10:37:33 EST 2007 i686 i686 i386 GNU/Linux
The i686 indicates this is a 32-bit system.

Example output on a 64-bit system:

Linux my64bitsystem 2.6.18-53.1.6.el5xen #1 SMP Wed Jan 16 04:10:44 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
The x86_64 indicates this is a 64-bit system. Note that 64-bit hardware can also run 32-bit software.

2) The output of “arch
Example output on a 64bit PowerPC system:

[root@power5-2 getconf]# arch
ppc64

Attention:
getconfig LONG_BIT is not a good method. Because the result is determined by soft link /usr/libexec/getconf/default.
Different target of soft link, different result. For a example:

[root@power5-2 getconf]# getconf LONG_BIT
32
[root@power5-2 getconf]# mv default default.bak
[root@power5-2 getconf]# ln -s POSIX_V6_LP64_OFF64 default
[root@power5-2 getconf]# ll
total 48
lrwxrwxrwx 1 root root 19 Sep 22 22:55 default -> POSIX_V6_LP64_OFF64
lrwxrwxrwx 1 root root 20 Jul 28 00:32 default.bak -> POSIX_V6_ILP32_OFF32
-rwxr-xr-x 1 root root 0 Sep 22 22:54 POSIX_V6_ILP32_OFF32
-rwxr-xr-x 1 root root 19892 Jan 9 2009 POSIX_V6_ILP32_OFFBIG
-rwxr-xr-x 1 root root 26264 Jan 10 2009 POSIX_V6_LP64_OFF64
[root@power5-2 getconf]# getconf LONG_BIT
64
[root@power5-2 getconf]#

disable error_reporting in php script.
error_reporting(0); -> at the beginning of the script. or can be made also from .htaccess:
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_flag log_errors on
php_flag ignore_repeated_errors off
php_flag ignore_repeated_source off
php_flag report_memleaks on
php_flag track_errors on
php_value docref_root 0
php_value docref_ext 0
php_value error_log php_errors.log
php_value error_reporting 999999999
php_value log_errors_max_len 0

<Files php_errors.log>
Order allow,deny
Deny from all
Satisfy All
</Files>

Qmail queue is growing. How can I speed up process of sending mail?
Article ID: 1414
Last Review: Oct,6 2008
Author:
Last updated by: system
Resolution

Usually Qmail queue is growing due to too many messages in remote queue, because sending mail to remote servers takes
much more time than delivering the message to the local mailbox.

By default Qmail uses up to 20 ‘qmail-remote’ processes to deliver mail to remote servers. This value can be not enough
if the server has heavy mail traffic. In this case you can increase number of simultaneously running ‘qmail-remote’
processes by creating /var/qmail/control/concurrencyremote file with needed value, for example:

# echo 50 > /var/qmail/control/concurrencyremote

Then restart Qmail. See “man qmail-control” for more information. Also, see the articles about SPAM issue 766.
Keywords: big queue stuck mail slow delivery

How do I rebuild qmail queue if it is damaged or consists of a lot of spam messages?
Article ID: 252
Last Review: Mar,5 2009
Author: Vitaly Malakhov
Last updated by: Vitaly Malakhov APPLIES TO:

* Plesk 8.x for Linux/Unix
* Plesk 7.5.x Reloaded

Resolution

This instruction is written for RPM-based systems (RedHat, Fedora, CentOS, etc…).

Please perform the following steps to recreate Qmail`s queue.

Attention!

All current messages will be removed from the queue in this case and cannot be restored.

1. Stop Qmail and xinetd.

/etc/init.d/qmail stop
/etc/init.d/xinetd stop

2. Move current queue to another location.

mv /var/qmail/queue /var/qmail/queue_old

3 Reinstall ‘psa-qmail’ RPM to recreate qmail queue structure with the command like:

rpm -Uvh --force psa-qmail....

4.(Optional).Reinstall drweb-qmail RPM if you use DrWeb antivirus feature which comes with Plesk.

rpm -Uvh --force drweb-qmail....

5.Start Qmail and xinetd:

/etc/init.d/qmail start
/etc/init.d/xinetd start

Note: you should get the both psa-qmail and drweb-qmail RPMs from the same Plesk version distributive which is installed
on the server.
You can obtain current psa-qmail, drweb-qmail RPMs and Plesk build versions by running the following commands on Linux
systems:


rpm -q psa-qmail
rpm -q drweb-qmail
rpm -q psa