Recursively Execute A Locally Defined Python Script On Remote Machines
I'm interested in writing a script so that the only copy of the script resides on my local machine, but the script executes on remote machines, possibly with the remote machines ex
Solution 1:
No, you won't be able accomplish this in one step (except for python -c 'print "hello world"'
maybe). But fabric might make your life a little easier.
Solution 2:
The Python binary does have a -c
option that lets you pass in valid Python code as an argument. For example:
$ python -c "print 'hello'; print 'world'"
prints
hello
world
Your script may have dependencies or be too complex for this, but it does handle more trivial commands.
Solution 3:
I know that sshuttle does this "bootstrapping" as part of its normal execution. It assumes the existence of a Python interpreter on the remote end of an ssh connection, and uploads code to run.
I haven't investigated the code to find out exactly what it does, but it should be reasonably straightforward to find.
Post a Comment for "Recursively Execute A Locally Defined Python Script On Remote Machines"