Memcache启动脚本


#!/bin/sh   
#   
# memcached:    MemCached Daemon   
#   
# chkconfig:    - 90 25    
# description:  MemCached Daemon   
#   
# Source function library.   
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
    
start()
{
        echo -n $"Starting memcached: "
        daemon /usr/local/bin/memcached -u daemon -d -m 4096 -l 10.10.10.220 -p 58728
        echo
}   

stop()
{
        echo -n $"Shutting down memcached: "
        killproc memcached
        echo
}   
    
[ -f /usr/local/bin/memcached ] || exit 0

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

P.S.
chmod +x /etc/init.d/memcached
chkconfig --level 2345 memcached on
service memcached start

ubuntu、debain:
apt-get -y install chkconfig

发表评论

电子邮件地址不会被公开。 必填项已用*标注