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
  Threading with python in sending multiple commands? searching1 0 534 Jun-12-2019, 09:13 PM
Last Post: searching1
  Python script hangs after entering username to remote login using telnetlib auto 0 1,686 Sep-10-2018, 01:10 PM
Last Post: auto
  Sending DNS responses with python - research dnsman2018 0 1,122 Aug-05-2018, 12:01 PM
Last Post: dnsman2018
Question How to copy files from local system to remote machine? sahan 3 2,002 Mar-01-2017, 09:26 AM
Last Post: sahan
  sending email with python shahpy 4 5,030 Oct-03-2016, 10:00 PM
Last Post: shahpy

Forum Jump:


Users browsing this thread: 1 Guest(s)