Linux设置Memcached开机启动
作者:52php 发布时间:[ 2016/7/15 10:38:25 ] 推荐标签:测试开发技术 Linux Memcached
Memcached开机启动方式
方法一:
在 /etc/rc.d/rc.local 文件中追加启动命令
/usr/local/memcached/bin/memcached -u root -d -m 2048 -l 192.168.137.99 -p 11211 -P /tmp/memcached.pid
也可不指定IP,默认是本机,如
/usr/local/memcached/bin/memcached -u deamon -d -m 2048 -p 11211 -P /tmp/memcached.pid
用户好是 apache 或 deamon
方法二:
#写服务脚本
vim /etc/init.d/memcached
粘贴如下代码
#!/bin/sh
#
# memcached: MemCached Daemon
#
# chkconfig: - 90 25
# description: MemCached Daemon
#
# 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="192.168.137.98"
SERVER_PORT="11211"
[ -f $MEMCACHED ] || exit 1
start()
{
echo -n $"Starting memcached: "
daemon $MEMCACHED -u daemon -d -m 2048 -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
相关推荐
更新发布
功能测试和接口测试的区别
2023/3/23 14:23:39如何写好测试用例文档
2023/3/22 16:17:39常用的选择回归测试的方式有哪些?
2022/6/14 16:14:27测试流程中需要重点把关几个过程?
2021/10/18 15:37:44性能测试的七种方法
2021/9/17 15:19:29全链路压测优化思路
2021/9/14 15:42:25性能测试流程浅谈
2021/5/28 17:25:47常见的APP性能测试指标
2021/5/8 17:01:11