Ubuntu Redis Self-boot configuration file

Source: Internet
Author: User

#!/bin/SH# Chkconfig:2345  - Ten# # # BEGIN INIT info# Provides:redis-server# Required-start: $network $remote _fs $syslog $ Time# Required-Stop: $network # Default-start:2 3 4 5# Default-stop:0 1 6# Short-description:start/stop redis-server### END INIT info## Simple Redis INIT.D script conceived to work on Linux systems# as it does use of the/proc FileSystem. Redisport=6379EXEC=/usr/local/bin/redis-servercliexec=/usr/local/bin/redis-Clipidfile=/var/run/redis_${redisport}.pidconf="/etc/redis/${redisport}.conf" Case " $" inchstart)if[ -F $PIDFILE] Then            Echo "$PIDFILE exists, process is already running or crashed"        Else            Echo "starting Redis_$redisport Server ..."$EXEC $CONFfi        ;; Stop)if[ ! -F $PIDFILE] Then            Echo "$PIDFILE does not exist, process was not running"        ElsePID=$(Cat$PIDFILE)Echo "stopping ..."<%if@password = ='NoPass'-%>$CLIEXEC-p $REDISPORT shutdown<%Else-%>$CLIEXEC-P $REDISPORT-a <%= @password%>shutdown<% End-%> while[-x/proc/${pid}] Do                Echo "waiting for Redis_$redisport to shutdown ..."                Sleep 2             Done            Echo "Redis_$redisport stopped"        fi        ;; Status) PID=$(Cat$PIDFILE)if[ -F $PIDFILE] Then          if[!-x/proc/${pid}] Then            Echo 'Redis_$redisport is not running'            RM-RF $PIDFILE Exit1          Else            Echo "Redis_$redisport is running"          fi        Else          Echo 'No PID File,redis_$redisport is not running'Exit1        fi        ;; Restart) $0Stop $0start;; *)        Echo "Please use start, stop, restart or status as first argument"        ;;Esac

Ubuntu Redis Self-boot configuration file

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.