码迷,mamicode.com
首页 > 系统相关 > 详细

memcached自启动

时间:2017-01-22 15:09:57      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:chm   called   命令   add   6.4   rc.d   memcach   work   config   

#
# Source function library.

. /etc/rc.d/init.d/functions
. /etc/sysconfig/network

#[ ${NETWORKING} = "no" ] && exit 0
#[ -r /etc/sysconfig/dund ] || exit 0
#. /etc/sysconfig/dund
#[ -z "$DUNDARGS" ] && exit 0

MEMCACHED="/usr/local/memcached/bin/memcached"
SERVER_IP="172.16.26.4"
SERVER_PORT="11211"

[ -f $MEMCACHED ] || exit 1

start()
{
echo -n $"Starting memcached: "
daemon $MEMCACHED -u root -d -m 1024 -l $SERVER_IP -p $SERVER_PORT -P /tmp/memcached.pid
echo
}
stop()
{
echo -n $"Shutting down memcached: "
killproc memcached
echo
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0

#设置启动服务
1、chmod 755 /etc/init.d/memcached #增加执行权限
2、chkconfig --add memcached #添加memcached到服务项
3、chkconfig --level 2345 memcached on #设置开机启动
4、chkconfig --list memcached #查看是否设置成功
#服务管理命令
1、service memcached start # 启动memcached
2、service memcached stop # 关闭memcached
3、service memcached restart # 重启memcached

memcached自启动

标签:chm   called   命令   add   6.4   rc.d   memcach   work   config   

原文地址:http://www.cnblogs.com/wangchunniu1314/p/6340059.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!