CentOS7下/etc/rc.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 ~]#
原文地址:https://www.cnblogs.com/huazhixu/p/17251254.html
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- 设计模式(一):Android 源码中的单例模式
- Flask(数据库操作 十一)
- Golang | 既是接口又是类型,interface是什么神仙用法?
- 剑指offer第11题:机器人运动范围
- SQL 查找是否"存在",别再 count 了,很耗费时间的!
- 【LeeCode 中等 字节 python3】567. 字符串的排列
- Spark实现WordCount的几种方式总结
- Redis6之pub/sub发布与订阅(对比List和Kafka)
- SpringBoot原理?属性配置?在这里
- 【LeeCode 中等 矩阵】面试题 01.07. 旋转矩阵
- pytest文档44-allure.dynamic动态生成用例标题
- Java自动化测试(TestNg参数化 11)
- 宋宝华:论Linux的页迁移(Page Migration)上集
- 火遍全网的自热火锅哪款最好吃?我们用Python告诉你!
- 剑指offer第10题:矩阵中的路径