buildbot

Start daemon as one step


My workflow for testing require starting 2 NodeJS apps (tests starting later and send REST requests to started daemons). But obviously step that running node server.js is never ending (of course until server app stopped).

I tried to start is as command='nohup node server.js &' but it doesn't works - still waits for step finishing.

How could I start daemon as one of testing step?


Solution

  • Well, finally I sorted it. I don't know why but if command in ShellCommand doesn't returned to prompt (like when using & at the end of command) it treated like "not finished and killed by timeout. So I cannot just start daemon like nohup node ./server.js &.

    But it can be worked around if this command placed in shell script. I created runner that using to start daemons and it works.

    #!/bin/bash
    
    CMD="$1 $2 $3 $4"
    [ $# -eq 0 ] && { echo "Usage: $0 [FILE_1] [FILE_2] [FILE_3]"; exit 1; }
    eval "${CMD}" &>/dev/null &!;
    

    Usage: /usr/local/bin/runner /node-v8.x-linux-x64/bin/node server.js