####################################################### # 检查selinux是否开启 ####################################################### function selinux_check() { echo "" echo -e "\033[36m -------------------------------->> \033[0m" echo -e "\033[36m selinux_check, starting... \033[0m" echo -e "\033[36m -------------------------------- \033[0m" local selinux_result=`getenforce` if [[ $selinux_result == "Enforcing" ]]; then echo "selinux is Enforcing now, disable first, quit." cp /etc/selinux/config /etc/selinux/config"`date +"%Y%m%d%H%M%S"`" sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config setenforce 0 echo "" echo -e "\033[32m ******************************* \033[0m" echo -e "\033[32m selinux_check, pass... \033[0m" echo -e "\033[32m ******************************* \033[0m"} else echo "" echo -e "\033[32m ******************************* \033[0m" echo -e "\033[32m selinux_check, pass... \033[0m" echo -e "\033[32m ******************************* \033[0m"} fi }