Skip to content

Instantly share code, notes, and snippets.

@evilmarty

evilmarty/run.sh

Created Feb 16, 2015
Embed
What would you like to do?
Run a process defined in a Procfile
#!/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