Homebrew: How to check if a homebrew service is switched on or not
brew services list
gives the status of the services. so something like brew services list | grep elastiscearch | awk '{ print $2}'
should return the status of the elastic search service, whether started or stopped
Just run:
brew services
Sample Output
Name Status User Plistgrafana started mark /Users/mark/Library/LaunchAgents/homebrew.mxcl.grafana.plistinfluxdb started mark /Users/mark/Library/LaunchAgents/homebrew.mxcl.influxdb.plistmosquitto stopped redis started mark /Users/mark/Library/LaunchAgents/homebrew.mxcl.redis.plistunbound stopped
You can also run the following command to get the process id (pid) of the homebrew services:
launchctl list | grep homebrew460 0 homebrew.mxcl.influxdb484 0 homebrew.mxcl.grafana469 0 homebrew.mxcl.redis