Skip to content
Snippets Groups Projects
Verified Commit da376b5f authored by David Beniamine's avatar David Beniamine
Browse files

Transmit file in one netcat

parent 909b75ee
No related branches found
No related tags found
No related merge requests found
......@@ -17,18 +17,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1)
netcat="netcat -l $IP 9999"
port=9999
netcat="netcat -l $IP $port"
KPID=`ps aux | grep "$netcat" | awk '{print $2}'`
[ ! -z "$KPID" ] && kill $KPID
[ ! -z "$KPID" ] && kill $KPID > /dev/null 2>&1
subnet=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1 | cut -d . -f 1-3)
host=$subnet.52
port=9999
echo "get_registry" | netcat $host $port
nline=$($netcat | cut -d ' ' -f 1)
i=0;
for i in $(seq 1 $nline)
do
$netcat
done
stdbuf -i0 $netcat
......@@ -47,11 +47,6 @@ do
done
elif [ $MAC == "get_registry" ]
then
hostfile="/etc/registry/hosts"
wc -l $hostfile | netcat $host $port
while read line
do
echo "$line" | netcat $host $port
done < $hostfile
stdbuf -oL cat /etc/registry/hosts | netcat $host $port
fi
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment