Just in case it isn't obvious, I haven't tested any of those scripts so they are probably wrong in one way or another. Like the listener should probably sleep for a few seconds before trying to netcat into the port, depending on how long it takes ejabberd to spin up.
Cheers! -- "If the doors of perception were cleansed every thing would appear to man as it is, infinite. For man has closed himself up, till he sees all things thru' narrow chinks of his cavern." -- William Blake
