Shell writes Redis startup script

Source: Internet
Author: User
Tags redis redis server
#!/bin/bash  #  # Init file for redis  # FROM:JC # email:jiechao2013@gmail.com # chkconfig:-12  # Description:redis daemon  #  # processname:redis  # config:/opt/redis-2.6.4/redis.conf  # pidfil E:/var/run/redis.pid         source/etc/init.d/functions         & nbsp      bin= "/opt/redis/bin" config= "/opt/redis-2.6.4/redis.conf" pidfile= "/var/run/redis.pid"        # # Read configuration  [-R "$SYSCONFIG"] && source "$SYSCONFIG"      &N Bsp retval=0  prog= "Redis-server" desc= "Redis server"        start () {       &NB Sp     If [-e $PIDFILE];then          echo "$desc already running ..."     &NB Sp   Exit 1      fi             Echo-n $ "Starting $desc:"   &NB Sp Daemon $BIN/$pRog $CONFIG &             retval=$?      echo      [ $RETVAL-eq 0] && touch/var/lock/subsys/$prog       return $RETVAL  }      &NB sp;  Stop () {      Echo-n $ "Stop $desc:"     Killproc $prog       retval=$?& nbsp     echo      [$RETVAL-eq 0] && rm-f/var/lock/subsys/$prog $PIDFILE     &NB Sp Return $RETVAL  }         restart () {      stop      START&NBS P }                case "$" in start)       start     ;   stop)       stop     ;;   restart)       restart     ;;   Condrestart)       [-e/var/lock/subsys/$prog] && restart      RETVAL=$?&NBsp    ;;   status)       status $prog       retval=$?     ;;     *)       echo $ "Usage: $ start|stop|restart|condrestart|status}"     RETVAL=1&NBS P esac        

Exit $RETVAL


from:http://jiechao2012.blog.51cto.com/3251753/1193241

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.