If I understand your question correctly, I think you are doing it too hard. os.fork()Designed for multiprocessing, and not for running the program in the background.
Say, for the sake of discussion, that you wanted to run program.shand collect what it sends to standard output. To do this with a cloth, create locally:
fabfile.py:
from fabric.api import run
def runmyprogram():
run('./program.sh > output 2> /dev/null < /dev/null &')
Then, locally, run:
fab -H remotebox runmyprogram
The program will be executed remotely, but the fabric will not wait for its completion. You will need to collect the output files later, possibly using scp. "&" makes this run in the background on a remote computer, and output redirection is necessary to avoid a hanging network session .
, . ssh
nohup ./program.sh > output &
, .
, , , cron , , .
, :
fabfile.py:
from fabric.api import run
def runmyprogram():
run('./program.sh')
:
fab -H remotebox runmyprogram > output &
. , . , , , .