惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

博客园 - darkblue

mysql官方资源 MYSQL时间查询相关 mysql-用户管理 mysql备份还原 水液代谢与五脏调节 津液 献给成长中的孩子们 oracle--v$lock type字段详解 iis日志字段解析 Asp.net Core学习文章 如何让vs2017 EF实体生成支持Mysql 和 Oracle? 连接sqlexpress mysql-root本地无法登录处理 阿里云乌班图16配置-PHP环境(包括mysql及apache安装) mysql主从复制跳过错误 64位系统下powerdesigner15连接oracle odbc 解决“指定的服务已经标记为删除”问题 mysql系列-安装及服务启动 数据缓存管理
redis-在乌班图下设置自动启动
darkblue · 2016-10-20 · via 博客园 - darkblue

一、修改redis.conf

1、打开后台运行选项,默认情况下,Redis不在后台运行;

     daemonize yes 

2、配置log文件地址,默认使用标准输入,即打印在命令行终端 的窗口上

     logfile "/var/log/redis.log"

二、脚本设置

cp /redis的源码目录/utils/redis_init_scripts /etc/init.d/redis 

添加执行权限:chmod +x /etc/init.d/redis 

三、设置开机自动启动,关机自动关闭 

update-rc.d redis  defaults

会提示 insserv: warning: script 'redis6379' missing LSB tags and overrides

则修改脚本,添加前面几行 

#!/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:          redis6379
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: redis6379
# Description:       penavico redis 6379
### END INIT INFO

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 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
        ;;
    *)
        echo "Please use start or stop as first argument"
        ;;
esac
~

update-rc.d redis  defaults

尝试启动或停止redis  

service redis start

service redis stop

四、服务检查

 进行常规测试

 如果有错误,可以使用一下命令查看详细信息

 systemctl status redis.service 

 journalctl -xe