diff --git a/run/server.sh b/run/server.sh index 34fb06b..2babc4a 100644 --- a/run/server.sh +++ b/run/server.sh @@ -14,36 +14,37 @@ if [ "$2" != "ipinfo" ]; then RESPONSE="HTTP/1.1 200 OK\nContent-Length: ${LENGTH}\nConnection: close\n\n$HTML\n\n" while true; do - echo -en "$RESPONSE" | nc -lp "${1:-5000}" & wait $! + echo -en "$RESPONSE" | nc -lp "${1:-5000}" >/dev/null 2>&1 & wait $! done exit 0 fi -SH_SCRIPT="/run/ipinfo.sh" +SH_SCRIPT="/tmp/ipinfo.sh" -{ echo "INFO=\$(curl -s -m 5 -S http://127.0.0.1:2210/read?command=10 2>&1)" +{ echo "#!/bin/bash" + echo "INFO=\$(curl -s -m 5 -S http://127.0.0.1:2210/read?command=10 2>/dev/null)" echo "rest=\${INFO#*http_port}" echo "rest=\${rest#*:}" echo "rest=\${rest%%,*}" - echo 'PORT=\${rest%%\"*}' + echo "PORT=\${rest%%\\\"*}" echo "rest=\${INFO#*eth0}" echo "rest=\${rest#*ip}" echo "rest=\${rest#*:}" - echo 'rest=\${rest#*\"}' - echo 'IP=\${rest%%\"*}' - echo "BODY=\"The location of DSM is http://\${IP}:\${PORT}\"" - echo "HTML=\"