首页 > 代码库 > ubuntu redis 自启动配置文件
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=6379EXEC=/usr/local/bin/redis-serverCLIEXEC=/usr/local/bin/redis-cliPIDFILE=/var/run/redis_${REDISPORT}.pidCONF="/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 自启动配置文件
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。