From 596f9fa811c28b764c782526874ec5cb5fa79f22 Mon Sep 17 00:00:00 2001 From: iiiiiii1 <25471406+iiiiiii1@users.noreply.github.com> Date: Sat, 12 May 2018 13:42:51 +0800 Subject: [PATCH] Update socat.sh --- socat.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/socat.sh b/socat.sh index f837c2d..20015da 100644 --- a/socat.sh +++ b/socat.sh @@ -15,14 +15,14 @@ Green="\033[32m" Font="\033[0m" Blue="\033[33m" -function rootness(){ +rootness(){ if [[ $EUID -ne 0 ]]; then echo "Error:This script must be run as root!" 1>&2 exit 1 fi } -function checkos(){ +checkos(){ if [[ -f /etc/redhat-release ]];then OS=CentOS elif cat /etc/issue | grep -q -E -i "debian";then @@ -43,14 +43,14 @@ function checkos(){ fi } -function disable_selinux(){ +disable_selinux(){ if [ -s /etc/selinux/config ] && grep 'SELINUX=enforcing' /etc/selinux/config; then sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config setenforce 0 fi } -function disable_iptables(){ +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 @@ -147,7 +147,7 @@ install_socat(){ fi } -function status_socat(){ +status_socat(){ if [ -s /usr/bin/socat ]; then echo -e "${Green}检测到Socat已存在,并跳过安装步骤!${Font}" main_x @@ -157,18 +157,22 @@ function status_socat(){ } main_x(){ +checkos +rootness +disable_selinux +disable_iptables config_socat start_socat } main_y(){ +checkos +rootness +disable_selinux +disable_iptables install_socat config_socat start_socat } -checkos; -rootness; -disable_selinux; -disable_iptables; -status_socat; +status_socat