Execute remote python script via SSH

前端 未结 4 621
不知归路
不知归路 2021-01-31 05:14

I want to execute a Python script on several (15+) remote machine using SSH. After invoking the script/command I need to disconnect ssh session and keep the processes running in

4条回答
  •  逝去的感伤
    2021-01-31 05:23

    If you are going to perform repetitive tasks on many hosts, like for example deploying software and running setup scripts, you should consider using something like Fabric

    Fabric is a Python (2.5 or higher) library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.

    It provides a basic suite of operations for executing local or remote shell commands (normally or via sudo) and uploading/downloading files, as well as auxiliary functionality such as prompting the running user for input, or aborting execution.

    Typical use involves creating a Python module containing one or more functions, then executing them via the fab command-line tool.

提交回复
热议问题