Share memcached shell start stop script

Source: Internet
Author: User
Tags memcached stop script

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.