Skip to content

Instantly share code, notes, and snippets.

@monokrome
Last active December 19, 2015 11:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monokrome/5951057 to your computer and use it in GitHub Desktop.
Save monokrome/5951057 to your computer and use it in GitHub Desktop.
Makes loading and running Homebrew's nginx on OS X easier.
#!/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