Note: To use this shell, you must first successfully establish the MEMCACHE Environment 1 "memcached File and permissions [[email protected] ~]# Touch/etc/init.d/memcached[[email Protected] ~]# chmod +x/etc/init.d/memcached2 write memcached Shell management script vi/etc/init.d/memcached#!/bin/bash# Memcached-t His shell script takes care of starting and stopping memcached.## chkconfig:-10# Description:memcache provides fast Memory based storage.# processname:memcachedmemcached_path= "/usr/local/bin/memcached" memcached_pid= "/var/run/ Memcached.pid "memcached_memory=" "# Source function library. /etc/rc.d/init.d/functions[-x $memcached _path] | | Exit 0retval=0prog= "memcached" # Start Daemons.start () {If [-e $memcached _pid-a!-Z $memcached _pid];then ech o $prog "already running ..." Exit 1 fi echo-n $ "Starting $prog" # Single instance for all caches $me Mcached_path-m $memcached _memory-l 0.0.0.0-p 11211-u root-d-P $memcached _pid retval=$?[$RETVAL-eq 0] && {touch/var/lock/subsys/$prog success $ "$prog"} Echo return $RETVAL} # Stop Daemons.stop () {echo-n $ "stopping $prog" killproc-d $memcached _path echo [$RETVAL = 0] &&A mp Rm-f $memcached _pid/var/lock/subsys/$prog retval=$?
Return $RETVAL}# See how we were Called.case "$" in start) start; stop) stop;; Status) status $prog retval=$?
;; restart) stop start;; *) echo $ "Usage: $ Start|stop|status|restart}" Exit 1esacexit $RETVAL ############# #本脚本中的以下二个配置可依据实 and configure ############ #memcached_path = "/usr/local/bin/memcached" #memcached_memory = "1024" 3 "The script is investigated for system service Chkconfig--add memcached chkconfig memcached on
4 "Test (try hackers AH)
<p>service memcached Start|stop|status|restart </p>
Share memcached shell start stop script