Linux优化开机自启服务

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

CentOS release 6.5 (Final)

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

必须保留的启动服务:
crond:定时任务服务
network:网络服务
rsyslog:日志服务
sshd:远程链接服务
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

猜你喜欢

转载自www.cnblogs.com/hzdwwzz/p/9723375.html