Skip to content

Instantly share code, notes, and snippets.

@stevenmirabito
Last active July 21, 2016 19:19
Show Gist options
  • Save stevenmirabito/1118cede7d9d1145ad7cb24a709bf14a to your computer and use it in GitHub Desktop.
Save stevenmirabito/1118cede7d9d1145ad7cb24a709bf14a to your computer and use it in GitHub Desktop.
Cloud9 IDE Launcher/Management Script
#!/bin/bash
# Cloud9 IDE Launcher
# Author: Steven Mirabito ([email protected])
# Configuration
C9_IP=127.0.0.1
C9_PORT=8080
C9_HOME=$HOME/.c9
C9_APPDIR=$HOME/.cloud9
# ========== END CONFIGURATION ========== #
if [ "$1" = "stop" ]; then
kill $(pgrep -f cloud9 | grep -v ^$$\$) > /dev/null 2>&1
echo "✅ Stopped Cloud9"
exit 0
fi
export PATH=$PATH:$C9_HOME/bin:$C9_HOME/node/bin
if [ ! -d "$C9_HOME" ] || [ ! -d "$C9_APPDIR" ]; then
echo "🛠 Performing first time setup..."
rm -rf $C9_APPDIR
rm -rf $C9_HOME
git clone git://github.com/c9/core.git $C9_APPDIR
cd $C9_APPDIR
mkdir -p $C9_HOME
bash $C9_APPDIR/scripts/install-sdk.sh
fi
if [ ! -f "$C9_APPDIR/settings/standalone-pwd.js" ]; then
echo "⚙ Creating config file..."
cp $C9_APPDIR/settings/standalone.js $C9_APPDIR/settings/standalone-pwd.js
sed -i 's|path.resolve(__dirname + "/../")|process.env.WORKSPACE|g' $C9_APPDIR/settings/standalone-pwd.js
fi
IP=$C9_IP PORT=$C9_PORT WORKSPACE=$PWD $C9_HOME/node/bin/node $C9_APPDIR/server.js -s standalone-pwd > $C9_HOME/cloud9-${PWD##*/}.log 2>&1 &
echo "✅ Started Cloud9"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment