Update socat.sh

master
iiiiiii1 2018-05-12 09:21:19 +08:00 committed by GitHub
parent f1cd951191
commit 58ce4e5eb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -79,6 +79,13 @@ start_socat(){
chmod +x /etc/rc.d/rc.local
else
if [ -s /etc/rc.local ]; then
sed -i '/exit/d' /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
else
echo -e "${Green}检测到系统无/etc/rc.local自启正在为其配置... ${Font} "
echo "[Unit]
Description=/etc/rc.local
@ -114,12 +121,6 @@ start_socat(){
chmod +x /etc/rc.local
systemctl enable rc-local >/dev/null 2>&1
systemctl start rc-local >/dev/null 2>&1
else
sed -i '/exit/d' /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
fi
fi
get_ip