Introduction¶
The standard Python module multiprocessing
got introduced in Python 2.6 and makes creating simple client/server applications extremely easy.
Here is an example that shows how to execute arbitrary commands remotely. Because it allows executing arbitrary commands it is probably a good idea to not use it exactly like this, but rather to extend it to do only exactly what you want it to do (like kill one specific application or so).
You can download a package with the following files
os_system_py-20130730-1347.zip
(and an additional file squishpyutil.py
.
Example - Using os_system_client.py in Squish test scripts¶
Prerequisites:
Script
os_system_client.py
must reside in test suite directoryScript
os_system_server.py
must running on the remote computerScript
squishpyutil.py
must reside in same folder asos_system_client.py
Example - Using os_system_client.py without Squish¶
Prerequisites:
- Script
os_system_server.py
must have been started on the remote computer
Executed in cmd.exe
:
C:\Users\MyUser\Desktop> python os_system_client.py DIR
Executing remotely: "DIR"
[...]
Related information¶
Please note that there are platform specific tools, like PsExec which may be an option if you can limit yourself to the platform(s) supported by them.