# wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
3)本次安装用到的所有软件下载地址(安装环境为CentOS-6.5)
http://download.csdn.net/detail/clevercode/8654863
#!/bin/sh # # Startup script for the server of memcached #http://blog.rekfan.com/?p=172 # processname: memcached # pidfile: /usr/local/memcached/memcached.pid # logfile: /usr/local/memcached/memcached_log.txt # memcached_home: /etc/memcached # chkconfig: 35 21 79 # description: Start and stop memcached Service # Source function library . /etc/rc.d/init.d/functions RETVAL=0 prog="memcached" basedir=/usr/local/memcached cmd=${basedir}/bin/memcached pidfile="$basedir/${prog}.pid" #logfile="$basedir/memcached_log.txt" # 设置memcached启动参数 ipaddr="192.168.224.128" # 绑定侦听的IP地址 port="11211" # 服务端口 username="root" # 运行程序的用户身份 max_memory=64 # default: 64M | 最大使用内存 max_simul_conn=1024 # default: 1024 | 最大同时连接数 #maxcon=51200 #growth_factor=1.3 # default: 1.25 | 块大小增长因子 #thread_num=6 # default: 4 #verbose="-vv" # 查看详细启动信息 #bind_protocol=binary # ascii, binary, or auto (default) start() { echo -n $"Starting service: $prog" $cmd -d -m $max_memory -u $username -l $ipaddr -p $port -c $max_simul_conn -P $pidfile RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog } stop() { echo -n $"Stopping service: $prog " run_user=`whoami` pidlist=`ps -ef | grep $run_user | grep memcached | grep -v grep | awk '{print($2)}'` for pid in $pidlist do # echo "pid=$pid" kill -9 $pid if [ $? -ne 0 ]; then return 1 fi done RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog } # See how we were called. case "$1" in start) start ;; stop) stop ;; #reload) # reload # ;; restart) stop start ;; #condrestart) # if [ -f /var/lock/subsys/$prog ]; then # stop # start # fi # ;; status) status memcached ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac exit $RETVAL
# chkconfig --level 35 memcached on
service memcached restart
版权声明:
1)原创作品,出自"CleverCode的博客",转载时请务必注明以下原创地址,否则追究版权法律责任。
2)原创地址:http://blog.csdn.net/clevercode/article/details/45441881(转载务必注明该地址)。
3)博客专栏地址(Linux常用软件安装与配置):http://blog.csdn.net/column/details/linuxsoftwareinstall.html(持续增加,关注请收藏)。
4)欢迎大家关注我博客更多的精彩内容:http://blog.csdn.net/CleverCode。