/etc/rc.local开启自启不执行问题

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

[root@localhost ~]# 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.

/usr/bin/rsync --daemon

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

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

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

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

  

 

转载于:https://www.cnblogs.com/pandj/p/9491636.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值