• redis服务脚本(支持密码)


    #!/bin/sh
    #Configurations injected by install_server below....
    
    EXEC=/usr/local/bin/redis-server
    CLIEXEC=/usr/local/bin/redis-cli
    PIDFILE=/var/run/redis_6379.pid
    CONF="/etc/redis/6379.conf"
    REDISPORT="6379"
    PASSWORD="**********"
    ###############
    # SysV Init Information
    # chkconfig: - 58 74
    # description: redis_6379 is the redis daemon.
    ### BEGIN INIT INFO
    # Provides: redis_6379
    # Required-Start: $network $local_fs $remote_fs
    # Required-Stop: $network $local_fs $remote_fs
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Should-Start: $syslog $named
    # Should-Stop: $syslog $named
    # Short-Description: start and stop redis_6379
    # Description: Redis daemon
    ### END INIT INFO
    
    
    case "$1" in
        start)
            if [ -f $PIDFILE ]
            then
                echo "$PIDFILE exists, process is already running or crashed"
            else
                echo "Starting Redis server..."
                $EXEC $CONF
            fi
            ;;
        stop)
            if [ ! -f $PIDFILE ]
            then
                echo "$PIDFILE does not exist, process is not running"
            else
                PID=$(cat $PIDFILE)
                echo "Stopping ..."
                $CLIEXEC -a $PASSWORD -p $REDISPORT shutdown
                while [ -x /proc/${PID} ]
                do
                    echo "Waiting for Redis to shutdown ..."
                    sleep 1
                done
                echo "Redis stopped"
            fi
            ;;
        status)
            PID=$(cat $PIDFILE)
            if [ ! -x /proc/${PID} ]
            then
                echo 'Redis is not running'
            else
                echo "Redis is running ($PID)"
            fi
            ;;
        restart)
            $0 stop
            $0 start
            ;;
        *)
            echo "Please use start, stop, restart or status as first argument"
            ;;
    esac
  • 相关阅读:
    潜入ICU的四逆汤
    经方医的视角
    黄连解毒汤治疗月经过多
    柳暗花明又一方
    PHP 相关性系数计算
    备忘-VSCODE、apache配置
    c# 基于文件系统实现的队列处理类
    notepad++ 快速运行PHP代码
    dat.gui stats.js 通用参数配置及图像统计工具
    AutoHotkey 自动化脚本工具实例
  • 原文地址:https://www.cnblogs.com/longzhu/p/5815790.html
Copyright © 2020-2023  润新知