Skip to content

Instantly share code, notes, and snippets.

@seanbehan
Forked from ches/pow
Created July 1, 2011 01:42
Show Gist options
  • Save seanbehan/1057702 to your computer and use it in GitHub Desktop.
Save seanbehan/1057702 to your computer and use it in GitHub Desktop.
A quick script to switch between running Pow and Apache 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 /System/Library/LaunchDaemons/org.apache.httpd.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 /System/Library/LaunchDaemons/org.apache.httpd.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