Chinaunix首页 | 论坛 | 博客
  • 博客访问: 67919
  • 博文数量: 27
  • 博客积分: 1096
  • 博客等级: 少尉
  • 技术积分: 280
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-13 19:21
文章分类

全部博文(27)

文章存档

2011年(1)

2008年(26)

我的朋友

分类:

2008-07-14 10:45:44

#!/bin/sh
# Author: jackylau
# Description: delete disnecessary service for Linux or SunOS

PATH=/sbin:/bin:/usr/bin

case `uname -s` in
SunOS)
echo
echo "Yours Operation System is Solaris? if not,Please press "Ctrl+c"!"
delser(){
for i in `ls /etc/rc2.d/S*`
do
SERVICE=${i#/etc/rc2.d/S??}
for SE in $SERVICE
do
echo $SE

done
echo -n "Will you delete the $i service ?[y/n/Y/N/yes/no]"
SER=${i#/etc/rc2.d/}
read answer
case $answer in
Y|y|yes)
mv $SER _$SER
;;
N|n|no)
continue
;;
*)
echo -n "please Y|y or N|n,thanks!"
echo -n "Will you delete the $j service ?"
read answer
;;
esac
done

}
cd /etc/rc2.d
delser
cd /etc/rc3.d
delser
;;
Linux)
echo
echo "Yours Operation System is Linux? if not,Please press "Ctrl+c"!"
for j in `chkconfig --list|awk '{if($5~/on/ && NF>3) print $1}'|awk '{print $1}'`
do
echo -n "Will you delete the $j service ?[y/n/Y/N/yes/no]"
read answer
case $answer in
Y|y|yes)
chkconfig --level 35 $j off
;;
N|n|no)
continue
;;
*)
echo -n "please Y|y or N|n,!"
echo -n "Will you delete the $j service ?"
read answer
;;
esac
done
;;
*)
echo "Your Server don't supported the script"
;;
esac
阅读(563) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~