Created
February 4, 2026 09:44
-
-
Save isurfer21/4b6ce66b06108dff7f5c65566a5ab077 to your computer and use it in GitHub Desktop.
MongoDB Service Manager for macOS (using Homebrew)
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
| #!/usr/bin/env zsh | |
| # MongoDB Service Manager for macOS (using Homebrew) | |
| # Usage: ./mongodb-manager.sh [start|stop|restart|status] | |
| SERVICE_NAME="mongodb-community" | |
| SERVICE_PATH="mongodb/brew/$SERVICE_NAME" | |
| case "$1" in | |
| start) | |
| echo "Starting MongoDB..." | |
| brew services start $SERVICE_PATH | |
| ;; | |
| stop) | |
| echo "Stopping MongoDB..." | |
| brew services stop $SERVICE_PATH | |
| ;; | |
| restart) | |
| echo "Restarting MongoDB..." | |
| brew services restart $SERVICE_PATH | |
| ;; | |
| status) | |
| echo "Checking MongoDB status..." | |
| brew services list | grep $SERVICE_NAME | |
| ;; | |
| *) | |
| echo "Usage: ${0##*/} {start|stop|restart|status}" | |
| exit 1 | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment