#!/bin/bash
#####################################################################################
#ThescriptisusedtocheckwhethertheoptimizescripthadbeenrunonCentOS6.x
#Createdbyshengwei
#####################################################################################
.
/etc/init
.d
/functions
check_iptables(){
/iptables
status>
/dev/null
2>&1
[$?-
ne
0]&&action
"Optimizeiptables:"
/bin/true
||action
/bin/false
}
check_selinux(){
selinux_status=`getenforce`
[$selinux_status==
'Disabled'
]&&action
"Optimizeselinux:"
/bin/false
}
check_addusers(){
eq
"Addusers:"
/bin/false
}
check_install(){
rpm-qa|
"gcc|gcc-c++|openssh-clients|wget|make|cmake|curl|finger|nmap|tcp_wrappers|expect|lrzsz|unzip|zip|xz|ntpdate|lsof|telnet|vim|tree"
>
2>&1
"Installsoftwares:"
/bin/false
}
check_repos(){
[-d
/etc/yum
.repos.d
/bak
"Updaterepos:"
/bin/false
}
check_time(){
date
-R|
grep
+0800>
2>&1
"Settingtimezone:"
/bin/false
crond_num=`
crontab
-l|
ntpdate|
wc
-l`
[$crond_num-
ge
1]&&action
"Synctime:"
/bin/false
}
check_services(){
service_num=`chkconfig--list|
3:on|
"crond|network|rsyslog|sshd"
|
-l`
[$service_num-
4]&&action
"Optimizeservices:"
/bin/false
}
check_history(){
[$HISTSIZE-
10000]&&action
"Settinghistory:"
/bin/false
}
check_kernel(){
conn_num=`
ulimit
-n`
[$conn_num-
2097152]&&action
"Optimizekernel:"
/bin/false
}
check_hostname(){
[$HOSTNAME!=
'localhost.localdomain'
"Changehostname:"
/bin/false
}
check_iptables
check_selinux
check_addusers
check_install
check_repos
check_time
check_services
check_history
check_kernel
check_hostname
|