#!/bin/bash

function jcecho {
    echo "==> javiercejudo.com: $1"
}

{
    while [[ ! -e /tmp/heroku.fcgi.5000.sock ]]; do
        sleep 1
    done;

    jcecho "Application ready!"
    sudo chmod o+w /tmp/heroku.fcgi.5000.sock
} &

jcecho "Starting application..."

if [[ $1 == "live" ]]
then sudo foreman start --env=.env.live
else sudo foreman start
fi

jcecho "Goodbye!"

#!/bin/bash

function jcecho {
    echo "==> javiercejudo.com: $1"
}

{
    while [ ! -e /tmp/heroku.fcgi.5000.sock ]; do
        sleep 1
    done;

    jcecho "Application ready!"
    sudo chmod o+w /tmp/heroku.fcgi.5000.sock
} &

jcecho "Starting application..."

sudo foreman start

jcecho "Goodbye!"

--- 
+++ 
@@ -5,7 +5,7 @@
 }
 
 {
-    while [ ! -e /tmp/heroku.fcgi.5000.sock ]; do
+    while [[ ! -e /tmp/heroku.fcgi.5000.sock ]]; do
         sleep 1
     done;
 
@@ -15,6 +15,9 @@
 
 jcecho "Starting application..."
 
-sudo foreman start
+if [[ $1 == "live" ]]
+then sudo foreman start --env=.env.live
+else sudo foreman start
+fi
 
 jcecho "Goodbye!"
Add live env option for local server script [skip ci]
