Question

I have bunch of tasks that I need to launch using another shell script.

I want to run the shell script using nohup mode, but the fabric refuses continue as there is no stdin

Traceback (most recent call last):
      File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/main.py", line 743, in main
        *args, **kwargs
      File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/tasks.py", line 368, in execute
        multiprocessing
      File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/tasks.py", line 264, in _execute
        return task.run(*args, **kwargs)
      File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/tasks.py", line 171, in run
        return self.wrapped(*args, **kwargs)
      File "/home/ubuntu/utils/deploy_to_ubuntu/deploy_worker.py", line 84, in deploy_existing
        run('sudo sh ~/existing_setup.sh')
      File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/network.py", line 578, in host_prompting_wrapper
        return func(*args, **kwargs)
      File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/operations.py", line 1042, in run
        shell_escape=shell_escape)
      File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/operations.py", line 911, in _run_command
        stderr=stderr, timeout=timeout)
      File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/operations.py", line 795, in _execute
        worker.raise_if_needed()
      File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/thread_handling.py", line 12, in wrapper
        callable(*args, **kwargs)
      File "/home/user/local/lib/python2.7/site-packages/Fabric-1.8.0-py2.7.egg/fabric/io.py", line 215, in input_loop
        byte = msvcrt.getch() if win32 else sys.stdin.read(1)
    IOError: [Errno 9] Bad file descriptor

I do not need stdin to be present for any of the terminals.

I am running fabric in the shellscript using --no-pty option but it is not helping at all

It is simply not possible to not run this nohup mode because it will take about 10 hours I do not want a terminal to be open for so long.

shellscript looks something like this:

fab --no-pty deploy.add_new_server
python runtests.py
python add_another_server_to_config.py
fab --no-pty deploy.add_new_server
python runtests.py
.
.
.

and I run nohup deploy_and_test.sh &

Was it helpful?

Solution

It was simple.

 nohup deploy_and_test.sh </dev/null &
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top