#!/bin/bash
function killfirewall(){
systemver=`cat /etc/*release* 2>/dev/null | awk 'NR==1{print}' |sed -r 's/.* ([0-9]+)\..*/\1/'`
if [[ $systemver = "6" ]];then
echo "当前是Centos6系统,禁用防火墙"
service iptables stop
chkconfig iptables off
elif [[ $systemver = "7" ]];then
echo "当前是Centos7系统,禁用防火墙"
systemctl disable firewalld
systemctl stop firewalld
else
echo "非Centos6、centos7、NeoKylin系统 无法关闭防火墙,安装失败!!!"
exit 1
fi
}
killfirewall