RHEL7和RHEL6即时设置、开启和开机、永久开启服务的方法、原理(例子:端口与Nginx冲突的Apache httpd服务的关闭)

1.RHEL7

  说明:启用服务就是在当前 runlevel 的配置文件目录/etc/systemd/system/multi-user.target.wants/里,建立/usr/lib/systemd/system里面对应服务配置文件的软链接;禁用服务就是删除此软链接。

  查看了/usr/lib/systemd/system 里的文件,语法跟旧版/etc/init.d/里的系统服务脚本完全不同了。

systemd使用比sysvinit的运行级更为自由的target替代。第3运行级(命令行界面)用multi-user.target替代。第5运行级(图形化界面)用graphical.target替代。runlevel3.target和runlevel5.target分别是指向 multi-user.target和graphical.target的符号链接

参考:

方法和原理:

https://blog.csdn.net/guochunyang/article/details/51954736

编写开机启动服务:

https://www.cnblogs.com/lycokcc/p/5239318.html

Nginx开机启动脚本例子:

http://blog.51cto.com/meiling/2165942

Tomcat开机启动脚本编写:

https://blog.csdn.net/qq_25821067/article/details/79120222

Apache设置开机启动和拒绝访问问题:

https://www.cnblogs.com/tdcqma/p/5868941.html

RHEL7&RHEL6比较:

https://www.liangzl.com/get-article-detail-15933.html

RHEL7启动原理:

https://www.cnblogs.com/xiaogan/p/5812145.html

https://www.cnblogs.com/chenxuf/p/9027575.html 

 

2.RHEL6

说明:经查看和测试确认,/etc/init.d是/etc/rc.d/init.d的软链接,/etc/rc.local是/etc/rc.d/rc.local的软链接,/etc/rc[0-6].d是/etc/rc.d/rc[0-6].d的软链接,/etc/rc.d/rc[0-6].d目录中都是指向init.d目录的软链接,命令行界面对应rc3.d,图形化界面对应rc5.d,分别是运行级别3和5

参考:

http://www.cnblogs.com/xuange306/p/9327809.html

编写开机启动脚本一定需要注意的:

解决“service XXX does not support chkconfig”的问题,参考http://blog.51cto.com/professor/1579791

常用的两种设置方式:

https://blog.csdn.net/karchar/article/details/52489572

原理和原始方法:

http://www.cnblogs.com/jimeper/archive/2013/03/12/2955687.html

https://blog.csdn.net/qq_32863631/article/details/78631174

另外的方法:

https://blog.csdn.net/u013554213/article/details/78792686

chkconfig命令详解:

https://www.linuxidc.com/Linux/2015-01/111438.htm

httpd服务启动、关闭设置参考:

https://blog.csdn.net/heqinghua217/article/details/51517849

tomcat设置开机启动:

https://blog.csdn.net/abselute/article/details/76945378

 

posted @ 2018-12-15 11:16  free_wings  阅读(844)  评论(0编辑  收藏  举报