Created
February 16, 2015 05:55
-
-
Save evilmarty/ed5b3cddf422bdce1d0a to your computer and use it in GitHub Desktop.
Run a process defined in a Procfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment