首页 » 脚本 » 正文

一键优化linux系统服务

#!/bin/bash
echo “###################停止服务STOP######################”
service NetworkManager stop
chkconfig –level 235 NetworkManager off
service acpid stop
chkconfig –level 235 acpid off
service autofs stop
chkconfig –level 235 autofs off
service avahi-daemon stop
chkconfig –level 235 avahi-daemon off
service avahi-dnsconfd stop
chkconfig –level 235 avahi-dnsconfd off
service bluetooth stop
chkconfig –level 235 bluetooth off
service hidd stop
chkconfig –level 235 hidd off
service dund stop
chkconfig –level 235 dund off
service pand stop
chkconfig –level 235 pand off
service hcid stop
chkconfig –level 235 hcid off
service capi stop
chkconfig –level 235 capi off
service cups stop
chkconfig –level 235 cups off
#service dnsmasq stop
#chkconfig –level 235 dnsmasq off
service firstboot stop
chkconfig –level 235 firstboot off
service hplip stop
chkconfig –level 235 hplip off
service ip6tables stop
chkconfig –level 235 ip6tables off
service ipmi stop
chkconfig –level 235 ipmi off
service ipmievd stop
chkconfig –level 235 ipmievd off
service irda stop
chkconfig –level 235 irda off
service isdn stop
chkconfig –level 235 isdn off
service lvm2-monitor stop
chkconfig –level 235 lvm2-monitor off
service mcstrans stop
chkconfig –level 235 mcstrans off
service microcode_ctl stop
chkconfig –level 235 microcode_ctl off
service netfs stop
chkconfig –level 235 netfs off
service netplugd stop
chkconfig –level 235 netplugd off
service nfs stop
chkconfig –level 235 nfs off
service nfslock stop
chkconfig –level 235 nfslock off
service nscd stop
chkconfig –level 235 nscd off
service pcscd stop
chkconfig –level 235 pcscd off
service portmap stop
chkconfig –level 235 portmap off
service psacct stop
chkconfig –level 235 psacct off
service restorecond stop
chkconfig –level 235 restorecond off
service rhnsd stop
chkconfig –level 235 rhnsd off
service rpcgssd stop
chkconfig –level 235 rpcgssd off
service rpcidmapd stop
chkconfig –level 235 rpcidmapd off
service rpcsvcgssd stop
chkconfig –level 235 rpcsvcgssd off
service saslauthd stop
chkconfig –level 235 saslauthd off
service sendmail stop
chkconfig –level 235 sendmail off
service setroubleshoot stop
chkconfig –level 235 setroubleshoot off
service smb stop
chkconfig –level 235 smb off
service squid stop
chkconfig –level 235 squid off
service vncserver stop
chkconfig –level 235 vncserver off
service winbind stop
chkconfig –level 235 winbind off
service wpa_supplicant stop
chkconfig –level 235 wpa_supplicant off
service ypbind stop
chkconfig –level 235 ypbind off
service yum-updatesd stop
chkconfig –level 235 yum-updatesd off
echo “###################stop#######################”

echo “###################启动服务start#######################”
service anacron restart
chkconfig –level 235 acpid on
service atd restart
chkconfig –level 235 atd on
service auditd restart
chkconfig –level 235 auditd on
service conman restart
chkconfig –level 235 conman on
service cpuspeed restart
chkconfig –level 235 cpuspeed on
service crond restart
chkconfig –level 235 crond on
service gpm restart
chkconfig –level 235 gpm on
service haldaemon restart
chkconfig –level 235 haldaemon on
service httpd restart
chkconfig –level 235 httpd on
service iptables restart
chkconfig –level 235 iptables on
service irqbalance restart
chkconfig –level 235 irqbalance on
service kdump restart
chkconfig –level 235 kdump on
service kudzu restart
chkconfig –level 235 kudzu on
service mdmonitor restart
chkconfig –level 235 mdmonitor on
service mdmpd restart
chkconfig –level 235 mdmpd on
service messagebus restart
chkconfig –level 235 messagebus on
service multipathd restart
chkconfig –level 235 multipathd on
service netconsole restart
chkconfig –level 235 netconsole on
service network restart
chkconfig –level 235 network on
service ntpd restart
chkconfig –level 235 ntpd on
service openibd restart
chkconfig –level 235 openibd on
service rawdevices restart
chkconfig –level 235 rawdevices on
service rdisc restart
chkconfig –level 235 rdisc on
service readahead_early restart
chkconfig –level 235 readahead_early on
service readahead_later restart
chkconfig –level 235 readahead_later on
service smartd restart
chkconfig –level 235 smartd on
service sshd restart
chkconfig –level 235 sshd on
service syslog restart
chkconfig –level 235 syslog on
service vsftpd restart
chkconfig –level 235 vsftpd on
service xfs restart
chkconfig –level 235 xfs on
service xinetd restart
chkconfig –level 235 xinetd on

echo “###################start#######################”