首页 > 系统相关 >CentOS7下/etc/rc.local开启自启不执行问题处理

CentOS7下/etc/rc.local开启自启不执行问题处理

时间:2023-03-24 13:35:41浏览次数:44  
标签:rsync root CentOS7 etc 自启 rc during local

1、原因:服务器重启后rsync服务没有起来,rsync启动已经写入/etc/rc.local中

2:分析:查看more /etc/rc.local

写启动内容没问题,也是全路径;查看 /etc/rc.local 文件,是一个链接,链接到 /etc/rc.d/rc.local,查看 /etc/rc.d/rc.local 文件,发现没有执行权限。

[root@master ~]#  more /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
/usr/local/sersync/bin/sersync2 -r -d -o /usr/local/sersync/conf/confxml.xml
[root@master ~]#

[root@slave ~]# more /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
rsync --daemon --config=/etc/rsyncd.conf
[root@slave ~]#

3、加上执行权限之后,再重启发现服务自动起来了。

[root@master ~]#   chmod +x /etc/rc.d/rc.local
[root@master ~]#   ll /etc/rc.d/rc.local
-rwxr-xr-x. 1 root root 527 Aug 17  2022 /etc/rc.d/rc.local
[root@master ~]#   reboot

[root@slave ~]#  lsof -i:873
COMMAND PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
rsync   888 root    4u  IPv4  21280      0t0  TCP *:rsync (LISTEN)
rsync   888 root    5u  IPv6  21281      0t0  TCP *:rsync (LISTEN)
[root@slave ~]#
[root@slave ~]#  netstat -lntup | grep rsync
tcp        0      0 0.0.0.0:873             0.0.0.0:*               LISTEN      888/rsync
tcp6       0      0 :::873                  :::*                    LISTEN      888/rsync
[root@slave ~]#

 

标签:rsync,root,CentOS7,etc,自启,rc,during,local
From: https://www.cnblogs.com/huazhixu/p/17251254.html

相关文章

  • Centos7下安装Elasticsearch6步骤
    Centos7下安装Elasticsearch6步骤1、安装jdk2、安装Elasticsearch1、新建一个esGroup组和用户(出于安全考虑,Elasticsearch默认是不允许使用root账号运行的)2、更改Elasticsear......
  • CentOS7关机重启之后,Mysql8启动不成功
    我在自己电脑上使用VM工具安装了虚拟机,CentOS7,里面继续安装了mysql8,下班的时候,直接把整个虚拟机关机了,没有依次关闭里面的服务,早上来的时候发现启动不来mysql 它提示用......
  • liunx 开机服务自启
    创建:进入/usr/lib/systemd/system/vim服务名称.service[Unit]Description=javaportalsite-webAfter=portalsite-webservice[Service][Service]Type=forkingExecStar......
  • 在aspnetcore中实现AOP的方式
    aaspnetcore开发框架中实现aop不仅仅在业务上,在代码的优雅简洁和架构的稳定上都有着至关重要。下面介绍三种用过的。 第一种使用DispatchProxy实现通过使用System.Re......
  • CentOS7 安装 Sublime Text3
    在官网下载,下载链接:http://www.sublimetext.com解压:sublime_text_build_4113_x64.tar.xz这是两层压缩,外面是xz压缩方式,里层是tar压缩[root@bogonwwwroot]#xz-dsublime_......
  • Centos7安装npm
    下载node镜像,这里我们选择node-v16.19.1-linux-x64.tar.gzwgethttps://nodejs.org/dist/v16.19.1/node-v16.19.1-linux-x64.tar.gz如果想下载其他版本,可以在https://......
  • aspnetcore中aop的实现
    aaspnetcore开发框架中实现aop不仅仅在业务上,在代码的优雅简洁和架构的稳定上都有着至关重要。下面介绍三种用过的。 第一种通过System.Reflection的DispatchProxy类来......
  • 使用Cursor怒刷LeetCode
    题目:如果一个数列由至少两个元素组成,且每两个连续元素之间的差值都相同,那么这个序列就是 等差数列 。更正式地,数列 s 是等差数列,只需要满足:对于每个有效的 i , s[i+1]......
  • Centos7搭建redis7集群
    redis集群搭建准备了3台主机,每台主机部署2个节点,整个集群3个master节点和3个slave节点组成主机:192.168.130.101 7001 7002      192.168.130.102 7001 70......
  • 高可用K8S集群中Master加入集群的时候报错:error execution phase check-etcd:解决方法
    报错信息:  报错原因:1、这个问题我找了两天没找到,最后找到网络的问题,我做的有双网卡,导致Master02和Master03服务器抢一个虚拟IP。2、Master02先抢到这个IP,Master03......