欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

memcache 启动

程序员文章站 2022-03-15 15:50:37
...
/usr/local/memcached/bin/memcached -d -m 2048 -p $1 -u root -vv >> /tmp/memcached.log 2>&1



#!/bin/sh  
echo "Start to start memcached server $(date)..."  
  
MEMCACHED=/usr/local/memcached/bin/memcached  
  
usage()  
{  
     echo "usage: `basename $0` port"  
}  
  
if [ -n "$1" ]  
then  
{  
     pid=`ps aux|grep memcached|grep "$1" |grep -v grep|awk '{print $2}'`  
     if [ -n "$pid" ]  
     then  
     {  
          sleep 2  
          echo "kill memcached which port is $1 begin"  
          echo "pid:$pid"  
          kill -9 $pid  
          echo "kill memcached which port is $1 end"  
          sleep 2  
     }  
     fi  
     echo "begin to start memcached in port $1"  
     LOG_FILE=/var/log/memcached/memcached_$1.log  
     rm -f $LOG_FILE  
     $MEMCACHED -d -m 128 -p $1 -u root -vv >> $LOG_FILE 2>&1  
     echo "start memcached end"  
     tail -f $LOG_FILE  
}  
else  
{  
     usage  
     exit 1  
}  
fi