Monthly Archives: November 2013

startup script for memcached processes

#!/bin/sh
#
# memcached Startup script for memcached processes
#
# chkconfig: – 90 10
# description: Memcache provides fast memory based storage.
# processname: memcached

# These mappings correspond one-to-one with Drupal’s settings.php file.

[ -f memcached ] || exit 0

prog=”memcached”

start() {
echo -n $”Starting $prog ”
# Sessions cache.
memcached -m 16 -l 0.0.0.0 -p 11211 -d -u nobody
# Default cache.
memcached -m 32 -l 0.0.0.0 -p 11212 -d -u nobody
# Block cache.
memcached -m 32 -l 0.0.0.0 -p 11213 -d -u nobody
# Content cache. Holds fully loaded content type structures.
memcached -m 16 -l 0.0.0.0 -p 11214 -d -u nobody
# Filter cache. Usually the busiest cache after the default.
memcached -m 32 -l 0.0.0.0 -p 11215 -d -u nobody
# Form cache.
memcached -m 32 -l 0.0.0.0 -p 11216 -d -u nobody
# Menu cache.
memcached -m 32 -l 0.0.0.0 -p 11217 -d -u nobody
# Page cache. Bigger than most other caches.
memcached -m 128 -l 0.0.0.0 -p 11218 -d -u nobody
# Views definition cache.
memcached -m 1 -l 0.0.0.0 -p 11219 -d -u nobody
# Views data cache (may need to be increased if heavily used).
memcached -m 32 -l 0.0.0.0 -p 11220 -d -u nobody

# More caches that might be added later:

# Users table.
#/usr/bin/memcached -m 24 -l 0.0.0.0 -p 11219 -d -u nobody
# Path source cache.
#/usr/bin/memcached -m 4 -l 0.0.0.0 -p 11220 -d -u nobody
# Path destination cache.
#/usr/bin/memcached -m 6 -l 0.0.0.0 -p 11221 -d -u nobody
RETVAL=$?
echo
return $RETVAL
}

stop() {
if test “x`pidof memcached`” != x; then
echo -n $”Stopping $prog ”
killall memcached
echo
fi
RETVAL=$?
return $RETVAL
}

case “$1” in
start)
start
;;

stop)
stop
;;

restart)
stop
start
;;
condrestart)
if test “x`pidof memcached`” != x; then
stop
start
fi
;;

*)
echo $”Usage: $0 {start|stop|restart|condrestart}”
exit 1

esac

exit $RETVAL

memcache on CentOS

yum install memcached php-pecl-memcache
pecl install memcache

if pecl fail you can install from source:
wget http://pecl.php.net/get/memcache
tar xvfz memcache-*
cd memcache*
phpize
./configure
make && make install
echo extension=memcache.so >> /etc/php.ini

service httpd restart
service memcached start
or maybe run manually:
memcached -d -m 512 -l 127.0.0.1 -p 11211 -u nobody

grub VGA modes

kernel /boot/vmlinuz-3.11.9-200.fc19.x86_64 root=/dev/sda1 ro vga=791

Colour depth 640×480 800×600 1024×768 1280×1024 1400×1050 1600×1200
8 (256) 769 771 773 775
15 (32K) 784 787 790 793
16 (65K) 785 788 791 794 834 884
24 (16M) 786 789 792 795

famd – The File Alteration Monitor (FAM) daemon

FAM, the File Alteration Monitor, is a subsystem that applications can use to be notified when specific files or directories are changed. It is intended as a replacement for mechanisms such as poll and select. FAM comes in two parts: famd, the daemon that listens for requests and provides notifications, and libfam, a library that client applications can use to communicate with FAM. For further information on libfam, see the fam(3) manual page. famd is normally started by an Internet superserver such as inetd or xinetd, but can also be started independently. Only one instance of famd can be run at a time.

silent cronjobs “>/dev/null 2>&1″

This will prevent send cronjobs notification emails to administrator. If you want to receive email notification in case a cron job failed to run properly, just use “>/dev/null” instead of “>/dev/null 2>&1″. “>/dev/null” will only ignore standard output, but will send all warning, debug, error and any other exception messages to root or email address specified.

php_pcre.h:29:18: error: pcre.h: No such file or directory

/usr/local/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /root/tmp/pear/APC/apc.c:45:
/usr/local/include/php/ext/pcre/php_pcre.h:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/local/include/php/ext/pcre/php_pcre.h:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/local/include/php/ext/pcre/php_pcre.h:44: error: expected specifier-qualifier-list before ‘pcre’
/root/tmp/pear/APC/apc.c:449: error: expected specifier-qualifier-list before ‘pcre’
/root/tmp/pear/APC/apc.c: In function ‘apc_regex_compile_array’:
/root/tmp/pear/APC/apc.c:510: error: ‘apc_regex’ has no member named ‘preg’
/root/tmp/pear/APC/apc.c:510: error: ‘apc_regex’ has no member named ‘preg’
/root/tmp/pear/APC/apc.c:511: error: ‘apc_regex’ has no member named ‘nreg’
/root/tmp/pear/APC/apc.c:511: error: ‘apc_regex’ has no member named ‘nreg’
/root/tmp/pear/APC/apc.c: In function ‘apc_regex_match_array’:
/root/tmp/pear/APC/apc.c:552: error: ‘apc_regex’ has no member named ‘preg’
/root/tmp/pear/APC/apc.c:552: error: ‘apc_regex’ has no member named ‘preg’
/root/tmp/pear/APC/apc.c:553: error: ‘apc_regex’ has no member named ‘nreg’
/root/tmp/pear/APC/apc.c:553: error: ‘apc_regex’ has no member named ‘nreg’
make: *** [apc.lo] Error 1
ERROR: `make’ failed

How to fix?
yum install pcre-devel

ftp xferlog format

xferlog.legacy:Mon Nov 25 14:21:37 2013 0 79.132.164.230 1830 var/www/html/test.php a _ o r web_user ftp 0 * c

Fri May 14 05:16:12 2010

Date/time stamp, nothing complicated.

0

Transfer time, in whole seconds (this transfer took less than a second, so zero).

::ffff:1.2.3.4

Remote host where the user connected from.

11974

Size of the transferred file (in bytes).

/home/user/public_html/index.php

Full path to the uploaded file.

a

Transfer type, a = ASCII (plain-text files), b = binary (everything else)

_

Action flag, C = compressed, U = uncompressed; T = tar’ed; _ = no action was taken.

i

Direction, i = incoming, o = outgoing, d = deleted.

r

Access mode, a = anonymous user, r = real (normal) user.

user

Local username authenticated with.

ftp

The service being invoked (almost always FTP).

0

Authentication method, 0 = none, 1 = RFC931 authetication.

*

User ID or * if not available (virtual user).

c

Completion status, c = completed, i = incomplete.

elrepo repo

The ELRepo Project focuses on hardware related packages to enhance your experience with Enterprise Linux. This includes filesystem drivers, graphics drivers, network drivers, sound drivers, webcam and video drivers.

Import the public key:

rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org (external link)

Detailed info on the GPG key used by the ELRepo Project can be found on https://www.elrepo.org/tiki/key (external link)

To install ELRepo for RHEL-5, SL-5 or CentOS-5:

rpm -Uvh http://www.elrepo.org/elrepo-release-5-4.el5.elrepo.noarch.rpm (external link)

To make use of our mirror system, please also install yum-fastestmirror.

To install ELRepo for RHEL-6, SL-6 or CentOS-6:

rpm -Uvh http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm (external link)

To make use of our mirror system, please also install yum-plugin-fastestmirror.