From 76fb6d8b408156ecd5f30c97d0c0be31e073a832 Mon Sep 17 00:00:00 2001 From: iiiiiii1 <25471406+iiiiiii1@users.noreply.github.com> Date: Fri, 18 May 2018 22:19:46 +0800 Subject: [PATCH] Update socat.sh --- socat.sh | 62 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/socat.sh b/socat.sh index 251c7e4..7cc76c7 100644 --- a/socat.sh +++ b/socat.sh @@ -87,39 +87,39 @@ start_socat(){ else echo -e "${Green}检测到系统无rc.local自启,正在为其配置... ${Font} " echo "[Unit] - Description=/etc/rc.local - ConditionPathExists=/etc/rc.local +Description=/etc/rc.local +ConditionPathExists=/etc/rc.local - [Service] - Type=forking - ExecStart=/etc/rc.local start - TimeoutSec=0 - StandardOutput=tty - RemainAfterExit=yes - SysVStartPriority=99 +[Service] +Type=forking +ExecStart=/etc/rc.local start +TimeoutSec=0 +StandardOutput=tty +RemainAfterExit=yes +SysVStartPriority=99 - [Install] - WantedBy=multi-user.target - " > /etc/systemd/system/rc-local.service - echo "#!/bin/sh -e - # - # rc.local - # - # This script is executed at the end of each multiuser runlevel. - # Make sure that the script will "exit 0" on success or any other - # value on error. - # - # In order to enable or disable this script just change the execution - # bits. - # - # By default this script does nothing. - " > /etc/rc.local - echo "nohup socat TCP4-LISTEN:${port1},reuseaddr,fork TCP4:${socatip}:${port2} >> /root/socat.log 2>&1 & - nohup socat -T 600 UDP4-LISTEN:${port1},reuseaddr,fork UDP4:${socatip}:${port2} >> /root/socat.log 2>&1 & - " >> /etc/rc.local - chmod +x /etc/rc.local - systemctl enable rc-local >/dev/null 2>&1 - systemctl start rc-local >/dev/null 2>&1 +[Install] +WantedBy=multi-user.target +" > /etc/systemd/system/rc-local.service +echo "#!/bin/sh -e +# +# rc.local +# +# This script is executed at the end of each multiuser runlevel. +# Make sure that the script will "exit 0" on success or any other +# value on error. +# +# In order to enable or disable this script just change the execution +# bits. +# +# By default this script does nothing. +" > /etc/rc.local +echo "nohup socat TCP4-LISTEN:${port1},reuseaddr,fork TCP4:${socatip}:${port2} >> /root/socat.log 2>&1 & +nohup socat -T 600 UDP4-LISTEN:${port1},reuseaddr,fork UDP4:${socatip}:${port2} >> /root/socat.log 2>&1 & +" >> /etc/rc.local +chmod +x /etc/rc.local +systemctl enable rc-local >/dev/null 2>&1 +systemctl start rc-local >/dev/null 2>&1 fi get_ip sleep 3