Can't get Fabric's detached screen session example to work

前端 未结 3 1526
名媛妹妹
名媛妹妹 2021-01-02 05:29

I am trying to execute a script on a remote host using a detached screen session. I tried out the example Fabric gives and unfortunately couldn\'t get it to work.

         


        
3条回答
  •  梦毁少年i
    2021-01-02 06:01

    Although AVB answer is perfect I'll add a small tip which may help someone like me. If you want to run more than one command put them to a executable file.

    This will not work:

    run('screen -d -m "./ENV/bin/activate; python run.py; sleep 1"')

    So create a run.sh file:

    #!/bin/bash
    source ENV/bin/activate
    python run.py
    

    And use it like run('screen -d -m ./run.sh; sleep 1')

提交回复
热议问题