Basically, i'm trying to run multiprocessing using Python that will utilize telnet to a server in order to send HTTP request. The request is recorded in request.txt full request with header.
In my python code, I've tested the full multiprocessing, it works like magic. However, once placed in the server, the bash commands are not executed properly.
What I'm trying to replicate in Python is the below bash sample:
START=
(
cat request.txt
sleep 2
)| telnet 0 999
what I'm doing in my python source code is:
os.system("START=\
(\
cat request.txt \
sleep 2 \
)| telnet 0 999\
")
what I'm getting is:
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
Connection closed by foreign host.
When I run the request manually over bash terminal, it runs perfectly without an error. However, when trying to execute python application, it gives the above behavior.
P/S the reason why I'm not posting the full source code is because my issue is only related to os.system - the bash part of the application.
Thank you