[ejabberd] Improvements in ejabberd start script - this proposal needs review

Badlop badlop at gmail.com
Tue Aug 21 19:11:21 MSD 2007

ejabberd does not include an start script. Instead, some minimal
instructions are available in the ejabberd Guide and in the examples/
For that reason, packagers for *nix distributions had to write their
own custom start scripts. The Windows installers are not affected,
because they include start and stop shortcuts.

The situation is problematic for that people that like to compile and
run the software themselves: they have to spend a lot of time reading
documentation, forum threads and the mailing list to get a good start
script. A good start script will attract more admins, will make
current admins happier, will not require us to spend so much time
giving help, and will incentivate packagers of more *nix distributions
to build ejabberd packages.

Some months ago ejabberd SVN got a start script, which also has
support for ejabberd_ctl [1]. I think that script can be improved
integrating several features available in other start scripts.

My proposal improves all the existing stuff in ejabberd SVN with many
other features copied from Debian official ejabberd package [2, 3, 4]
and Sander's proposal [5, 6].

The diff against ejabberd trunk SVN is available here:

I appreciate any comment; I want ejabberd to include a powerful
command-line script, unfortunately I'm not an expert in those topics.

I'll update the diff with your suggestions and bugfixes. Finally, it
will be submitted to ejabberd bug tracker for review and probably
integration in ejabberd trunk, in time for the next release.

Now let's see ejabberd + SVN + this patch in action.

$ cd ejabberd/truck/src

$ patch -p0 < startscript1.diff
patching file ejabberd.inetrc
patching file Makefile.in
patching file ejabberd.cfg.example
patching file ejabberd_ctl.erl
patching file ejabberdctl.cfg.example
patching file ejabberdctl.template

$ ./configure

$ make

$ su root

# make install

Directories created:
  /etc/ejabberd/ - Configuration files
    ejabberd.cfg - ejabberd configuration
    ejabberd.inetrc - Network DNS configuration
    ejabberdctl.cfg - Start script configuration
  /sbin/ejabberdctl - Start and administration script
  /var/lib/ejabberd/ - Installed files
    .erlang.cookie - Erlang cookie file
    db - Database spool files ejabberd files
    ebin - Binary ejabberd files (*.beam)
    priv -
      lib - Binary libraries (*.so)
      msgs - Translated strings (*.msgs)
  /var/log/ejabberd/* - Log files

The configuration files that the admin can edit and are not
overwritten by 'make install' are:
  ejabberd.cfg to define ejabberd internals
  ejabberdctl.cfg to configure several options of ejabberd start, Erlang/OTP...

ejabberd can be administered completely with just a command line
script: ejabberdctl, which provides arguments to start, stop, and many

This is an example shell session:

# ejabberdctl
RPC failed on the node ejabberd at localhost: nodedown

Commands to start an ejabberd node:
  start    Start an ejabberd node in server mode
  debug    Attach an interactive Erlang shell to a running ejabberd node
  live     Start an ejabberd node in live (interactive) mode

# ejabberdctl start

# ejabberdctl
Usage: ejabberdctl [--node node] command [options]

Available commands in this ejabberd node:
  status                         get ejabberd status
  stop                           stop ejabberd
  restart                        restart ejabberd
  reopen-log                     reopen log file
  register user server password  register a user
  unregister user server         unregister a user
  backup file                    store a database backup to file
  restore file                   restore a database backup from file
  install-fallback file          install a database fallback from file
  dump file                      dump a database to a text file
  load file                      restore a database from a text file
  import-file file               import user data from jabberd 1.4 spool file
  import-dir dir                 import user data from jabberd 1.4
spool directory
  delete-expired-messages        delete expired offline messages from database
  delete-old-messages n          delete offline messages older than n
days from database
  vhost host ...                 execute host-specific commands
  incoming-s2s-number            print number of incoming s2s
connections on the node
  outgoing-s2s-number            print number of outgoing s2s
connections on the node
  user-resources user server     print user's connected resources
  connected-users-number         print a number of established sessions
  connected-users                list all established sessions

  ejabberdctl restart
  ejabberdctl --node ejabberd at host restart

Commands to start an ejabberd node:
  start    Start an ejabberd node in server mode
  debug    Attach an interactive Erlang shell to a running ejabberd node
  live     Start an ejabberd node in live (interactive) mode

# ejabberdctl status
Node ejabberd at localhost is started. Status: started
ejabberd is running

# vim /etc/ejabberd/ejabberd.cfg

# ejabberdctl restart

# ejabberdctl stop


 Sander Devrieze
 Sergei Golovan
 Torsten Werner

[1] https://support.process-one.net/browse/EJAB-145
[2] http://svn.debian.org/wsvn/collab-maint/deb-maint/ejabberd/trunk/debian/patches/?rev=0&sc=0
[3] http://ftp.debian.org/debian/pool/main/e/ejabberd/ejabberd_1.1.2-9.diff.gz
[4] url: http://packages.debian.org/unstable/net/ejabberd
[5] https://support.process-one.net/browse/EJAB-68
[6] http://www.jabber.ru/bugzilla/show_bug.cgi?id=27

More information about the ejabberd mailing list