Last active
December 19, 2015 11:58
-
-
Save monokrome/5951057 to your computer and use it in GitHub Desktop.
Makes loading and running Homebrew's nginx on OS X easier.
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 sh | |
fail() { | |
echo "Failed to authenticate as superuser." | |
exit | |
} | |
# Verify that we have privileges or fail | |
test sudo || fail | |
if [[ -z "$1" ]]; then | |
action='start' | |
else | |
action="$1" | |
fi | |
# Load nginx | |
if [[ $action == 'start' || $action == 'load' ]]; then | |
sudo launchctl load /Library/LaunchAgents/homebrew.mxcl.nginx.plist | |
fi | |
# Already loaded now! | |
if [[ $action == 'load' ]]; then | |
exit | |
fi | |
sudo launchctl "$action" homebrew.mxcl.nginx | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment