Created
March 2, 2015 15:31
-
-
Save doismellburning/a78da357173683af728b to your computer and use it in GitHub Desktop.
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/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