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.
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