Skip to content

Instantly share code, notes, and snippets.

@egabancho
Created July 24, 2015 14:13
Show Gist options
  • Select an option

  • Save egabancho/7abf2561c02ea801545d to your computer and use it in GitHub Desktop.

Select an option

Save egabancho/7abf2561c02ea801545d to your computer and use it in GitHub Desktop.

Revisions

  1. egabancho revised this gist Jul 24, 2015. No changes.
  2. egabancho created this gist Jul 24, 2015.
    16 changes: 16 additions & 0 deletions mac_service.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    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
    }