memcached自启动
Posted humor1314
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了memcached自启动相关的知识,希望对你有一定的参考价值。
#
# 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自启动的主要内容,如果未能解决你的问题,请参考以下文章