0

I have a python script (audit.py) which collects information about a machine and prints the output at the end.

Along the way it asks for user input (using Pythons' raw_input functionality).

Is there a way to run this script on a remote machine, saving the output to a local file?

2

Assuming both servers are some sort of *nix install, have ssh keys set up for password-less logins, and the remote server has python.

Copy the script to the remote server:

scp audit.py serveraddress:~

Run the script on the remote machine, and save the output to a local file:

ssh serveraddress "./audit.py" >outputfile

If you are running it as a script, send it the input it needs:

cat input_for_auditpy | ssh serveraddress "./audit.py" >outputfile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.