代码
1 #!/bin/bash
2 #定制服务器服务
3
4 #服务列表
5 with_nfs='acpid anacron atd autofs bluetooth cups firstboot gpm hidd haldaemon isdn lm_sensors kudzu lvm2-monitor pcscd rawdevices mcstrans mdmonitor netfs nfslock portmap rpcgssd rpcidmapd restorecond setroubleshoot xfs yum-updatesd'
6 without_nfs='acpid anacron atd bluetooth cups firstboot gpm hidd haldaemon isdn lm_sensors kudzu lvm2-monitor pcscd rawdevices mcstrans mdmonitor restorecond setroubleshoot xfs yum-updatesd'
7 #函数
8 nfs() {
9 echo -ne '\e[32;1mIs the server running NFS ? [Y/N]\e[0m'
10 read answer
11 case $answer in
12 Y|y)answer=$without_nfs
13 ;;
14 N|n)answer=$with_nfs
15 esac
16 for s in $answer
17 do
18 if [[ `chkconfig --list|grep $s` ]];then
19 chkconfig --level 345 $s off
20 /etc/init.d/$s stop
21 fi
22 done
23 }
24 nfs