Skip to content

Instantly share code, notes, and snippets.

@SEJeff
Created November 4, 2010 19:25
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 SEJeff/663028 to your computer and use it in GitHub Desktop.
Save SEJeff/663028 to your computer and use it in GitHub Desktop.
This is the shell function I use to catch snowy tracebacks when a tomboy sync fails
debugdjango() {
action=${1:-traceback}
port=${2:-8000}
interface=${3:-lo}
TCPDUMP="tcpdump -i${interface} -A port ${port}"
case $action in
all)
echo "INFO: Running tcpdump on interface $interface and port $port" >&2
sudo $TCPDUMP
;;
traceback)
echo "INFO: Capturing tracebacks on interface $interface and port $port" >&2
sudo $TCPDUMP | egrep -A1 '^(File|Traceback)'
;;
*) cat <<- EOF >&2
Usage: $FUNCNAME [action] [port] [interface]
action = all, help, traceback
-traceback only prints python tracebacks (this is the default)
-all prints everything
-help prints this usage
port = port that snowy is running on. default=$port
interface = interface that snowy is listening on. default=$interface
NOTE: All arguments are optional
EOF
;;
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment