Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to run local python script to remote machine without sending
#1
I have created a python script on my local machine, i want to run this local script on multiple remote machines (Linux and Windows servers) and redirect the output to local machine.

For Example:

have to run the below local scripts to remote machines and redirect the output to local

Note: The python may not be available on some of the servers in that case will it work or not.

import psutil
total_mem = psutil.virtual_memory().total
used_mem = psutil.virtual_memory().used
used_percent = psutil.virtual_memory().percent

print("Total Mem:{}" .format(int(total_mem / 1000 ** 3)))
print("Used Mem:{}" .format(int(used_mem / 1000 ** 3)))
buran wrote Feb-21-2019, 01:36 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Quote
#2
You need to set up a server socket on your local machine, and a socket on the remote, and connect them.

See: https://docs.python.org/2/howto/sockets.html and https://realpython.com/python-sockets/
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Issues in Chat App for Local Network iMuny 2 219 Aug-19-2019, 10:25 AM
Last Post: iMuny
  Threading with python in sending multiple commands? searching1 0 298 Jun-12-2019, 09:13 PM
Last Post: searching1
  Trying to connect to a server running on another machine PythonForever 1 491 Jun-07-2019, 02:16 PM
Last Post: heiner55
  Assistance with Python Network script cscecela 2 863 Feb-24-2019, 01:23 AM
Last Post: searching1
  Pexpect - Python 3.7 - Unable to get my script past the login stage lgreenjr 3 891 Nov-01-2018, 10:49 PM
Last Post: lgreenjr
  No connection could be made becouse the target machine actively refused it. GottaAimHigherPal 1 583 Oct-18-2018, 01:59 PM
Last Post: Larz60+
  Is it possible to trun local internet access off programmatically? Larz60+ 4 646 Sep-25-2018, 08:10 AM
Last Post: DeaD_EyE
  Python script hangs after entering username to remote login using telnetlib auto 0 1,261 Sep-10-2018, 01:10 PM
Last Post: auto
  How to best communicate with android phone from PC running Python script? Sol33t303 1 832 Aug-30-2018, 05:04 AM
Last Post: buran
  Sending DNS responses with python - research dnsman2018 0 721 Aug-05-2018, 12:01 PM
Last Post: dnsman2018

Forum Jump:


Users browsing this thread: 1 Guest(s)