首页 > 代码库 > 检查系统是否一键优化成功的脚本

检查系统是否一键优化成功的脚本

vi check_optimize_ok.sh

 1 #!/bin/sh
 2 #by authors nulige 2016-03-21
 3 #检查系统优化成功脚本
 4 #set env
 5 export PATH=$PATH:/bin:/sbin:/usr/sbin
 6 export LANG="zh_CN.GB18030"
 7  
 8 #Repuire root to run this script.
 9 if [[ "$(whoami)" != "root" ]]; then
10        echo "Please run this script as root." >&2
11        exit 1
12 fi
13  
14 #Source function library.
15 . /etc/init.d/functions
16  
17 if [ `grep 18030 /etc/sysconfig/i18n|wc -l` -eq 1 ]
18        then
19        action "/etc/sysconfig/i18n" /bin/true
20 else
21        action "/etc/sysconfig/i18n" /bin/false
22 fi
23  
24 export LANG=en
25 if [ `chkconfig --list|grep 3:on|egrep "crond|network|syslog|sshd" |wc -l` -eq 4 ]
26        then
27        action "sys service init" /bin/true
28 else
29        action "sys service init" /bin/flase
30 fi
31  
32 if [ `grep 65535 /etc/security/limits.conf|wc -l` -eq 1 ]
33        then
34        action "etc/security/limits.conf" /bin/true
35 else
36        action "etc/security/limits.conf" /bin/false
37 fi 

 执行结果:

1 [root@mysql scripts]# sh check_optimize_ok.sh
2 /etc/sysconfig/i18n [确定]
3 sys service init [确定]
4 etc/security/limits.conf [确定]

 

检查系统是否一键优化成功的脚本