Skip to content

Instantly share code, notes, and snippets.

@doismellburning
Created March 2, 2015 15:31
Show Gist options
  • Save doismellburning/a78da357173683af728b to your computer and use it in GitHub Desktop.
Save doismellburning/a78da357173683af728b to your computer and use it in GitHub Desktop.
#!/bin/bash -x
# Very very hacky, I'm so sorry - KG
TYPE=$1
PROCFILE="./Procfile"
if [ -z $TYPE ]
then
echo "Please supply a process type as the first argument"
exit 1
fi
if [ ! -r $PROCFILE ]
then
echo "$PROCFILE does not exist / is not readable"
exit 2
fi
COMMAND=$(grep -- "^$TYPE: " $PROCFILE | tail -n 1 | perl -pe "s/.*?: //") # Awk is hard :(
if [ -z $COMMAND ]
then
echo "Could not find $TYPE in $PROCFILE, aborting"
exit 3
fi
exec $COMMAND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment