-
-
Save borgand/1042820 to your computer and use it in GitHub Desktop.
A quick script to switch between running Pow and MacPorts Apache2 on OS X
This file contains 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
#!/bin/sh -e | |
#/ Usage: pow [on|off] | |
#/ Toggle between running Pow (http://pow.cx) and Apache on Mac OS X. | |
# Show Usage | |
function usage { | |
grep '^#/' "$0" | cut -c4- | |
exit 2 | |
} | |
[ -z "$1" -o "$1" = "--help" ] && usage | |
# Fail fast if we're not on OS X | |
if [ "$(uname -s)" != "Darwin" ]; then | |
echo "You're not on OS X, so methinks you're not running Pow." 1>&2 | |
exit 1 | |
fi | |
toggle="$1" | |
case "$toggle" in | |
'on') | |
sudo launchctl unload /Library/LaunchDaemons/org.macports.apache2.plist | |
launchctl load ~/Library/LaunchAgents/cx.pow.powd.plist && | |
launchctl list | grep pow | |
;; | |
'off') | |
launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist | |
sudo launchctl load /Library/LaunchDaemons/org.macports.apache2.plist && | |
sudo launchctl list | grep apache | |
;; | |
*) | |
usage | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment