www.centos.org Forum Index CentOS 4 - Server Support MemCached
|
Bottom Previous Topic Next Topic |
| |
|
|
|---|
| Poster | Thread |
|---|
|
Re: MemCached | #2 |
|
|---|---|---|---|
|
Newbie
![]()
Joined: 2007/4/29
From
Posts: 6
|
here's an init script for you:
############################################################################ #!/bin/bash # init script for memcached # chkconfig: 2345 70 11 # description: memcached # processname: memcached # pidfile: /var/run/memcached.pid # Source function library. . /etc/rc.d/init.d/functions PATH=$PATH:/usr/local/bin lockfile=/var/lock/subsys/memcached logfile=/var/log/memcached pidfile=/tmp/memcached.pid prog=memcached memcached=/usr/local/bin/memcached RETVAL=0 start () { # find IP address on specific subnet ipaddr=`ifconfig | grep "192\.168\.0" | awk '{print $2}' | cut -d : -f 2` size=6144 # total cache size in MB port=11211 # port number to run on user=nobody # run as user opts="-d -m $size -l $ipaddr -p 11211 -u $user" # quit if IP address doesn't exist if [[ -z $ipaddr ]];then echo "IP address not found. please fix. exiting ." exit 1 fi echo -n $"Starting $prog: " daemon $memcached $opts RETVAL=$? echo [ $RETVAL = 0 ] && touch ${lockfile} return $RETVAL } stop () { echo -n $"Stopping $prog: " killproc memcached RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/memcached /var/run/memcached.pid } status () { psline1=`ps auxwww|grep -P "^USER"|grep -v grep` psline2=`ps auxwww|grep -P "^www\ .*memcached"|grep -v grep` if [[ -z $psline2 ]];then echo "memcached is not running" else echo "$psline1 $psline2" fi } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status ;; restart) stop sleep 1 start ;; *) echo $"Usage: `basename $0` {start|stop|restart|status}" exit 2 esac ############################################################################ change vars as necessary, you'll probably need to edit $ipaddr, $size, $port and $user. copy the script to /etc/init.d/memcached and then run `chkconfig --add memcached` and you should be set. OR do it a lil more ghetto and drop a one liner into /etc/rc.local like: /path/to/memcached -d -m 2048 -l 10.10.10.1 -p 11211 -u nobody |
||
Posted on: 2007/5/1 12:02
|
|||
|
Re: MemCached | #3 |
|
|---|---|---|---|
|
Newbie
![]()
Joined: 2007/4/19
From
Posts: 4
|
I tried the 'gheto' method but it didn't seem to work.. i'll try the other now...
|
||
Posted on: 2007/5/10 15:40
|
|||
|
Re: MemCached | #4 |
|
|---|---|---|---|
|
Newbie
![]()
Joined: 2007/7/11
From
Posts: 1
|
i too am trying to set up memcached on centos 4.4 (mediatemple dv base package). it has been a nightmare, first it was pecl issues (phpize to be exact), now its that php cant load the memcache.so file.
would it be too much to ask how you installed memcached + pecl/memcache? and also, did this autoload script end up working for you? thanks, tim garrison |
||
Posted on: 2007/7/11 6:19
|
|||
Top Previous Topic Next Topic |
|



Topic options
Print Topic
Threaded
Newest First
just1coder



You cannot start a new topic.
You can view topic.