Linux优化开机自启服务

[root@localhost ~]# cat /etc/redhat-release

CentOS release 6.5 (Final)

一般来说,linux系统不需要太多的自启服务,只要有几个比较重要的启动就行了

必须保留的启动服务:
1.crond:定时任务服务
2.network:网络服务
3.rsyslog:日志服务
4.sshd:远程链接服务
5.sysstat:系统监控服务(涉及一系列监控工具)

[root@localhost ~]# chkconfig --list

[root@localhost ~]# chkconfig --list|grep 3:on

[root@localhost ~]# chkconfig --list|grep 3:on|egrep -v "crond|sshd|network|rsyslog|sysstat"|awk '{print "chkconfig",$1,"off"}'|bash

或者输出重定向到一个文件再执行
[root@localhost ~]# echo "#!/bin/bash">/tmp/off.sh

[root@localhost ~]#chmod u+x /tmp/off.sh

[root@localhost ~]# chkconfig --list|grep 3:on|egrep -v "crond|sshd|network|rsyslog|sysstat"|awk '{print "chkconfig",$1,"off"}'>>/tmp/off.sh

[root@localhost ~]#bash /tmp/off.sh
posted @ 2018-09-29 14:01  HzdWwZz"LJF  阅读(166)  评论(0)    收藏  举报