views:

78

answers:

1

I was wonderng if anyone knows of a way to get into Mochiweb like ejabberd does when you run /sbin/ejabberdctl debug?

+2  A: 
  1. Make sure that -sname $NODE@$HOST (or -name $NODE@$FULLHOST) is present in parameters of erl call in start.sh of your mochiweb-based project
  2. Create file debug.sh with the following code:

    #!/bin/bash
    erl -sname debug_$NODE@$HOST -remsh $NODE@$HOST
    

Make sure not to mix sname and name in scripts, because nodes with short names can not communicate with nodes with full names (and vice versa). Additionally make sure to use the same cookie on both nodes either via -setcookie parameter of erl or via ~/.erlang.cookie file.

Of course you have to replace $NODE, $HOST and $FULLHOST with appropriate values.

gleber
Awesome, thanks! It didn't work at first b/c I had to also -setcookie to match, but it worked after that. Thanks a lot
ewindsor
Good point about the cookie. I'm using cookie from `~/.erlang.cookie` file so forgot about `-setcookie` thing :)
gleber
I've updated my answer to include bits about cookie
gleber