美文网首页
史上最简单的redis启动简本

史上最简单的redis启动简本

作者: 懒癌晚期的自律 | 来源:发表于2021-08-27 16:35 被阅读0次
    #!/bin/sh
    #
    # Simple Redis init.d script conceived to work on Linux systems
    # as it does use of the /proc filesystem.
    
    ### BEGIN INIT INFO
    # Provides:     redis_6379
    # Default-Start:        2 3 4 5
    # Default-Stop:         0 1 6
    # Short-Description:    Redis data structure server
    # Description:          Redis data structure server. See https://redis.io
    ### END INIT INFO
    #pid=`ps -efl|grep redis|grep -v $0|grep -v grep|wc -l`
    pid=`ps -ef|grep redis |grep 5378 |grep -v grep|awk '{print $2}' `
    echo "redisd的pid:${pid}"
    if [ $ps -eq 0 ];
    then
        echo -e "\n$(date '+%Y-%m-%d %H:%M:%S') start "
       /usr/local/redis/redis-3.0.0/src/redis-server  /usr/local/redis/redis-3.0.0/redis.conf 
        echo "$(date '+%Y-%m-%d %H:%M:%S') done"
    else
        echo $(date +%F%n%T) "redis正在关闭...pid=${pid}"
        kill -9 $pid
        echo $(date +%F%n%T) "redis正在关闭成功...pid=${pid}"
        echo $(date +%F%n%T) "redis正在启动..."
        /usr/local/redis/redis-3.0.0/src/redis-server  /usr/local/redis/redis-3.0.0/redis.conf 
        echo $(date +%F%n%T) "redis正在启动成功..."
        exit 0;
    fi
    

    相关文章

      网友评论

          本文标题:史上最简单的redis启动简本

          本文链接:https://www.haomeiwen.com/subject/ggbmiltx.html