Ubuntu下安装sysv-rc-conf报错:ubuntuE: Unable to locate package sysv-rc-conf (ubuntu 安装开机启动)

https://blog.csdn.net/apple_llb/article/details/50444280

 

#!/bin/bash

REDISPORT=8530
EXEC=/usr/local/redis/redis-4.0.9/src/redis-server
CLIEXEC=/usr/local/redis/redis-4.0.9/src/redis-cli

PIDFILE=/var/run/redis.pid
CONF="/usr/local/redis/redis-4.0.9/redis.conf"

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 -p $REDISPORT shutdown
            while [ -x /proc/${PID} ]
                do
                    echo "Waiting for Redis to shutdown..."
                    sleep 1
                done
                echo "Redis stopped"
        fi
        ;;
    restart)
        "$0" stop
        sleep 3
        "$0" start
        ;;
    *)
        echo "Please use start or stop or restart as first argument"
        ;;
esac

 

添加到开机自动服务

update-rc.d –f redis defaults

sysv-rc-conf redis_6379 on

用如下命令查看是否设置成功:

sysv-rc-conf --list redis

Ubuntu下安装sysv-rc-conf报错:ubuntuE: Unable to locate package sysv-rc-conf (ubuntu 安装开机启动)

上一篇:谷歌发布全新设计语言:跟苹果Swift天壤之别


下一篇:【转】Android开发在路上:少去踩坑,多走捷径