How can you use the Cloud9 IDE to work in the background?

I downloaded the Cloud9 IDE on my Mac according to the instructions https://github.com/ajaxorg/cloud9 and everything works fine. But I can not get it to work in the background, running through a bash script:

The bash script is called "ide" and has executable privileges:

#!/usr/bin/env sh
CLOUD_USER=`whoami`
CLOUD_DIR="/Users/$CLOUD_USER/Sites/cloud9"
CLOUD_PORT=3333
CLOUD_WORKSPACE="/Users/$CLOUD_USER/Sites"
CLOUD_ACTION="open"
CLOUD_BEFORE=""
CLOUD_AFTER=""


case "$1" in
    -b)
        CLOUD_BEFORE="nohup "
        CLOUD_AFTER="> /dev/null 2>&1 &"
        ;;
    .)
        CLOUD_WORKSPACE=`pwd`
        CLOUD_AFTER="-a $CLOUD_ACTION"
        ;;
    *)
        if [ $1 ]; then
            CLOUD_WORKSPACE=$1
        fi
        CLOUD_AFTER="-a $CLOUD_ACTION"
        ;;
esac

$CLOUD_BEFORE`/usr/local/node/bin/node $CLOUD_DIR/bin/cloud9.js -p $CLOUD_PORT -w $CLOUD_WORKSPACE` $CLOUD_AFTER

The idea is that you can run several ways:

$ ide

Starts Cloud9 and starts using the ~ / Sites folder as the workspace. Or you can specify the workspace by doing:

$ ide /path/to/workspace

or start the server in the background:

$ ide -b

... which does not exit the script.

I tried downloading “forever” (https://github.com/indexzero/forever). But, when I run it forever, it takes stdio and does not return to the command line.

: :

$ nohup /usr/local/node/bin/node /Users/{user}/Sites/cloud9/bin/cloud9.js -p 3333 -w /Users/{user}/Sites > /dev/null 2>&1 &

, script.

, ?

+5
1

$CLOUD_BEFORE`/usr/local/node/bin/node $CLOUD_DIR/bin/cloud9.js -p $CLOUD_PORT -w $CLOUD_WORKSPACE` $CLOUD_AFTER

$CLOUD_BEFORE"/usr/local/node/bin/node $CLOUD_DIR/bin/cloud9.js -p $CLOUD_PORT -w $CLOUD_WORKSPACE "$CLOUD_AFTER

:

[kaero@54221-2 ~]$ SF="sudo "
[kaero@54221-2 ~]$ FS=" aux"
[kaero@54221-2 ~]$ $SF`ps`$FS
Password:
sudo: PID: command not found
[kaero@54221-2 ~]$ $SF"ps"$FS
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
...
+2

All Articles