Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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