#!/bin/bash
mm_bin="/mnt/alidata/memcached-1.4.15-install/bin"
mm_ports=("11211" "11212")
mm_param=("-d -m 2048 -p 11211 -u root" "-d -m 2048 -p 11212 -u root")
mm_count=${#mm_ports[@]}
i=0
case $1 in
start)
cd ${mm_bin}
./memcached -d -m 2048 -p 11211 -u root
./memcached -d -m 2048 -p 11212 -u root
;;
stop)
while [ $i -lt $mm_count ]
do
pidlist=`ps -ef |grep memcache |grep -v "grep"|awk '{print $2}'`
kill -9 $pidlist
let i++
done
;;
restart)
while [ $i -lt $mm_count ]
do
pidlist=`ps -ef |grep memcache |grep -v "grep"|awk '{print $2}'`
kill -9 $pidlist
let i++
done
cd ${mm_bin}
./memcached -d -m 2048 -p 11211 -u root
./memcached -d -m 2048 -p 11212 -u root
;;
esac
启动服务:./memcach.sh start
使用shell脚本启动关闭memcache服务
最新推荐文章于 2022-04-24 10:27:28 发布