ubuntu redis 自启动配置文件
Posted 一路前行
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu redis 自启动配置文件相关的知识,希望对你有一定的参考价值。
#!/bin/sh # chkconfig: 2345 90 10 ### 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=6379 EXEC=/usr/local/bin/redis-server CLIEXEC=/usr/local/bin/redis-cli PIDFILE=/var/run/redis_${REDISPORT}.pid CONF="/etc/redis/${REDISPORT}.conf" case "$1" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed" else echo "Starting Redis_$REDISPORT server..." $EXEC $CONF fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist, process is not running" else PID=$(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 exit 1 else echo "Redis_$REDISPORT is running" fi else echo ‘No PID File,Redis_$REDISPORT is not running‘ exit 1 fi ;; restart) $0 stop $0 start ;; *) echo "Please use start, stop, restart or status as first argument" ;; esac
以上是关于ubuntu redis 自启动配置文件的主要内容,如果未能解决你的问题,请参考以下文章