From 641b541dc236c662a91e8270493efbbaa63ae4e6 Mon Sep 17 00:00:00 2001 From: iiiiiii1 <25471406+iiiiiii1@users.noreply.github.com> Date: Sat, 12 May 2018 09:09:04 +0800 Subject: [PATCH] Update socat.sh --- socat.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/socat.sh b/socat.sh index b377373..ad6f6aa 100644 --- a/socat.sh +++ b/socat.sh @@ -49,6 +49,13 @@ function disable_selinux(){ fi } +function disable_iptables(){ + systemctl stop firewalld.service >/dev/null 2>&1 + systemctl disable firewalld.service >/dev/null 2>&1 + service iptables stop >/dev/null 2>&1 + chkconfig iptables off >/dev/null 2>&1 +} + get_ip(){ ip=`curl http://whatismyip.akamai.com` } @@ -71,11 +78,8 @@ start_socat(){ " >> /etc/rc.d/rc.local chmod +x /etc/rc.d/rc.local else - source /etc/os-release &>/dev/null - if [[ "${ID}" == "debian" && ${VERSION_ID} -ge 9 ]];then - echo -e "${Green}检测到【Debian ${VERSION_ID}】无/etc/rc.local自启,正在为其配置... ${Font} " >/dev/null 2>&1 - elif [[ "${ID}" == "ubuntu" && `echo "${VERSION_ID}" | cut -d '.' -f1` -ge 17 ]];then - echo -e "${Green}检测到【Ubuntu ${VERSION_ID}】无/etc/rc.local自启,正在为其配置... ${Font} " >/dev/null 2>&1 + if [ -s /etc/rc.local ]; then + echo -e "${Green}检测到系统无/etc/rc.local自启,正在为其配置... ${Font} " echo "[Unit] Description=/etc/rc.local ConditionPathExists=/etc/rc.local @@ -118,10 +122,6 @@ start_socat(){ chmod +x /etc/rc.local fi fi - systemctl stop firewalld.service >/dev/null 2>&1 - systemctl disable firewalld.service >/dev/null 2>&1 - service iptables stop >/dev/null 2>&1 - chkconfig iptables off >/dev/null 2>&1 get_ip sleep 3 echo @@ -168,4 +168,5 @@ start_socat checkos; rootness; disable_selinux; +disable_iptables; status_socat;