Created
          July 24, 2015 14:13 
        
      - 
      
- 
        Save egabancho/7abf2561c02ea801545d to your computer and use it in GitHub Desktop. 
    Linux style service command on Mac OS X
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | 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