关于 CentOS 自启动(服务、脚本)

  • /etc/init.d /etc/rc.local 其实是软连接,所以,实际上看 /etc/rc.d/ 这个文件夹就好了
  • rc.local 是自启动脚本
  • 正常情况下,用户自定义的服务在 init.d 里面都有一个对应的可执行文件,然后在对应启动级别的rc*.d中有指向的软链接(K开头的表示不开机启动,S开头的表示开机启动)。命令chkconfig就是专门管理这些软链接的 http://www.cnblogs.com/panjun-Donet/archive/2010/08/10/1796873.html
chkconfig --add/--del xxx
chkconfig xxx off/on
  • crontab 定时任务,也能起到自启动的目的,比较类似
[logig@localhost /home]$ systemctl disable nginx
nginx.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig nginx off
You do not have enough privileges to perform this operation.
  • service xxx start/stop/status... 是对 systemctl start/stop/status/mask... xxx的不完整封装
  • 系统服务(native service)需要用 systemctl enable/disable/mask/unmask/show... 命令来查看和控制
  • https://linux.cn/article-5926-1.html
systemctl list-unit-files --type=service|grep enabled # 查看开机启动的服务
原文地址:https://www.cnblogs.com/liaozt/p/6236351.html