Skip to content

Instantly share code, notes, and snippets.

@borgand
Forked from ches/pow
Created June 23, 2011 15:50
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 borgand/1042820 to your computer and use it in GitHub Desktop.
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
#!/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