Skip to content

Instantly share code, notes, and snippets.

@egabancho
Created July 24, 2015 14:13
Show Gist options
  • Save egabancho/7abf2561c02ea801545d to your computer and use it in GitHub Desktop.
Save egabancho/7abf2561c02ea801545d to your computer and use it in GitHub Desktop.
Linux style service command on Mac OS X
function service {
# Needs brew services installed: brew tap homebrew/services
# $1 the service and $2 the action
# service mysql stop
# service mysql status
if [ $2 == "status" ]; then
STATUS=`brew services ls | grep --color=never $1`
if [ -n "$STATUS" ]; then
echo $STATUS
else
echo "$1 not running, maybe 'service $1 start'"
fi
else
brew services $2 $1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment