Update socat.sh

master
iiiiiii1 2018-05-18 22:19:46 +08:00 committed by GitHub
parent 2aa6e6ea05
commit 76fb6d8b40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 31 deletions

View File

@ -87,39 +87,39 @@ start_socat(){
else else
echo -e "${Green}检测到系统无rc.local自启正在为其配置... ${Font} " echo -e "${Green}检测到系统无rc.local自启正在为其配置... ${Font} "
echo "[Unit] echo "[Unit]
Description=/etc/rc.local Description=/etc/rc.local
ConditionPathExists=/etc/rc.local ConditionPathExists=/etc/rc.local
[Service] [Service]
Type=forking Type=forking
ExecStart=/etc/rc.local start ExecStart=/etc/rc.local start
TimeoutSec=0 TimeoutSec=0
StandardOutput=tty StandardOutput=tty
RemainAfterExit=yes RemainAfterExit=yes
SysVStartPriority=99 SysVStartPriority=99
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
" > /etc/systemd/system/rc-local.service " > /etc/systemd/system/rc-local.service
echo "#!/bin/sh -e echo "#!/bin/sh -e
# #
# rc.local # rc.local
# #
# This script is executed at the end of each multiuser runlevel. # This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other # Make sure that the script will "exit 0" on success or any other
# value on error. # value on error.
# #
# In order to enable or disable this script just change the execution # In order to enable or disable this script just change the execution
# bits. # bits.
# #
# By default this script does nothing. # By default this script does nothing.
" > /etc/rc.local " > /etc/rc.local
echo "nohup socat TCP4-LISTEN:${port1},reuseaddr,fork TCP4:${socatip}:${port2} >> /root/socat.log 2>&1 & 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 & nohup socat -T 600 UDP4-LISTEN:${port1},reuseaddr,fork UDP4:${socatip}:${port2} >> /root/socat.log 2>&1 &
" >> /etc/rc.local " >> /etc/rc.local
chmod +x /etc/rc.local chmod +x /etc/rc.local
systemctl enable rc-local >/dev/null 2>&1 systemctl enable rc-local >/dev/null 2>&1
systemctl start rc-local >/dev/null 2>&1 systemctl start rc-local >/dev/null 2>&1
fi fi
get_ip get_ip
sleep 3 sleep 3