Skip to content

Instantly share code, notes, and snippets.

@evilmarty
Created February 16, 2015 05:55
Show Gist options
  • Save evilmarty/ed5b3cddf422bdce1d0a to your computer and use it in GitHub Desktop.
Save evilmarty/ed5b3cddf422bdce1d0a to your computer and use it in GitHub Desktop.

Revisions

  1. evilmarty created this gist Feb 16, 2015.
    23 changes: 23 additions & 0 deletions run.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/bin/sh

    cwd=$(pwd)
    process=$1
    procfile="$cwd/Procfile"

    if [ ! -r $procfile ] ; then
    echo "$procfile does not exist or is not readable"
    exit -1
    fi

    if [[ ! "$process" ]] ; then
    process="web"
    fi

    command=`cat $procfile | grep -m 1 -e $process: | sed -E 's/[^:]+:\s*//'`

    if [[ ! "$command" ]] ; then
    echo "No command found for $process"
    exit -1
    fi

    $command