暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

设置redis随系统开机自动启动运行update-rc.d命令时报错“bash: update-rc.d: command not found...”

原创 Leo 2023-03-31
782

问题描述:设置redis随系统开机自动启动运行update-rc.d命令时报错“bash: update-rc.d: command not found...”,如下所示:

操作系统:rhel 7.9

Redis安装包:redis-stable.tar.gz

Tcl组件包:tcl8.6.1-src.tar.gz

1、异常重现

[root@leo-redis30 utils]# update-rc.d redis_6379 defaults

bash: update-rc.d: command not found...

系统信息如下:

[root@leo-redis30 utils]# cat /etc/*release

NAME="Red Hat Enterprise Linux Server"

VERSION="7.9 (Maipo)"

ID="rhel"

ID_LIKE="fedora"

VARIANT="Server"

VARIANT_ID="server"

VERSION_ID="7.9"

PRETTY_NAME="Red Hat Enterprise Linux Server 7.9 (Maipo)"

ANSI_COLOR="0;31"

CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server"

HOME_URL="https://www.redhat.com/"

BUG_REPORT_URL="https://bugzilla.redhat.com/"

 

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"

REDHAT_BUGZILLA_PRODUCT_VERSION=7.9

REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"

REDHAT_SUPPORT_PRODUCT_VERSION="7.9"

Red Hat Enterprise Linux Server release 7.9 (Maipo)

Red Hat Enterprise Linux Server release 7.9 (Maipo)

2、异常分析

出现sudo: update-rc.d: command not found错误时需使用chkconfig代替.

3、解决过程

[root@leo-redis30 init.d]# chkconfig --add redis_6379

[root@leo-redis30 init.d]# chkconfig --level 2345 redis_6379 on

[root@leo-redis30 init.d]# reboot

[root@leo-redis30 ~]# redis-cli

127.0.0.1:6379> set foo bar

OK

127.0.0.1:6379> get foo

"bar"

127.0.0.1:6379>

[root@leo-redis30 ~]# ps -ef|grep redis

avahi       828      1  0 14:18 ?        00:00:00 avahi-daemon: running [leo-redis30.local]

root       1286      1  0 14:18 ?        00:00:00 /usr/local/bin/redis-server 127.0.0.1:6379

root       2372   2246  0 14:25 pts/0    00:00:00 grep --color=auto redis

说明:如上所示,redis随系统的重启自动开启.

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论