码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-11-22 03:14:20      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:ssh   系统   his   exit   lis   blog   set   nbsp   path   

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 [确定]

 

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

标签:ssh   系统   his   exit   lis   blog   set   nbsp   path   

原文地址:http://www.cnblogs.com/nulige/p/6087653.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!