Python Forum
How to run local python script to remote machine without sending
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)))
Reply
#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/
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python + PHP. Sending data from "Moodle" (php) to python CGI-script and get it back stanislav 0 1,504 May-07-2022, 10:32 AM
Last Post: stanislav
  Threading with python in sending multiple commands? searching1 0 3,957 Jun-12-2019, 09:13 PM
Last Post: searching1
  Python script hangs after entering username to remote login using telnetlib auto 0 4,779 Sep-10-2018, 01:10 PM
Last Post: auto
  Sending DNS responses with python - research dnsman2018 0 4,904 Aug-05-2018, 12:01 PM
Last Post: dnsman2018
  Copy data from 1 blk device in machine A to another blk device in machine B AbhishekV 2 3,398 Feb-01-2018, 11:40 AM
Last Post: DeaD_EyE
Question How to copy files from local system to remote machine? sahan 3 4,859 Mar-01-2017, 09:26 AM
Last Post: sahan
  sending email with python shahpy 4 14,051 Oct-03-2016, 10:00 PM
Last Post: shahpy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020