JOH |
|
Jabber Over HTTP Tunnel |
Sergey Poznyakoff |
JOH User Manual (split by section): | ? |
johd
One of the basic assumptions made when designing johd
was
that it was to be run as a transport within Jabber configuration.
Therefore, after startup, johd
remains in the foreground and
does not disconnect from the controlling terminal. It also normally
sends all its diagnostic messages to the standard error output (but
see section Logging and Debugging, below.
To start jabber2
components we recommend using GNU
Pies
, instead of the default simple program manager shipped
with Jabberd2
. Pies
offers considerable
flexibility in handling jabber components. For a detailed description
of Pies, GNU Pies Manual: (pies)Top section `Top' in GNU Pies Manual. For an
example of Jabberd2
configuration with Pies, refer to
http://www.gnu.org.ua/software/pies/example.php?what=jabberd2.
To configure Pies to start johd
, add the following component
statement to your configuration file:
component johd { command "johd options"; strderr syslog err; }; |
Replace johd with the full pathname of the johd
binary, and options with the desired command line options.
For example:
component johd { command "/usr/sbin/johd -c HTTP"; strderr syslog err; }; |
Another way to start johd
is independently of the Jabber
server. To do so, give it the ‘-D’ command line option. This
option instructs johd
to disconnect from the controlling
terminal and run in the background as a daemon. Diagnostic messages
are then sent to the syslog, using the ‘daemon’ facility (this
can be changed using the ‘-F’ option; see section Logging and Debugging).
Normally, johd
continues its operation with the privileges
of the user who started it. If this user is root, you may wish
johd
to run as some other user. To do so, use the
‘-u’ option, e.g.:
johd -cHTTP -D -u nobody |
The daemon switches to new user after completing operations that require root privileges, such as, e.g. creating sockets that listen on ports below 1024, etc.
When starting johd
in daemon mode, it is also common to give
it the ‘-p’ option. This option takes a file name as argument
and causes the program to write its PID to that file after switching
to the background. If this file already exists, johd
will
read the PID from it and will check if a process with that PID is
actually running. If so, johd
refuses to startup and
outputs an appropriate diagnostics. Otherwise, it will overwrite the
file with the new PID value.
If both ‘-u’ and ‘-p’ are used, the pidfile is opened after switching to the user provileges. In this case, you should make sure the directory component of the pidfile is writable for the user supplied with the ‘-u’ option.
Following is an example startup command:
johd -D -p /var/run/johd.pid |
To automate startup and shutdown of johd
in daemon mode, use
the following shell script:
#! /bin/sh PIDFILE=/var/run/johd.pid case $1 in start) /usr/bin/johd -D -p $PIDFILE;; stop) test -f $PIDFILE && kill -TERM `cat $PIDFILE`;; restart) $0 stop $0 start;; *) echo >&2 "usage: $0 {start|stop|restart}" esac |
JOH User Manual (split by section): | ? |
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.