Service doesn't start automatically in CentOS

Hello all,
I successfully installed ejabberd 2.1.5 in CentOS 5.4 from the sources. I copied the init script to /etc/init.d and I am able to use it to start the service as follows:

/etc/init.d/ejabberd start

I created an ejabberd user as follows:

groupadd -r jabber
useradd -r gjabberd ejabberd

However whenever I reboot the server the service is not started. Is there any step I am missing?. I can't find it in the installation docs.
Thank you,
Iván Martínez

I know very little about this

I know very little about this topic. Maybe you also have to run something like this:
update-rc.d ejabberd defaults 65

Accordingly to this

Accordingly to this document:

http://www.cyberciti.biz/faq/rhel5-update-rcd-command/

the command for RedHat and CentOs is:

chkconfig --add ejabberd

but when I run it it says:

service ejabberd does not support chkconfig

I learned that in order to make Linux start ejabberd during boot I need to have a script in a /etc/rc?.d folder, but where do I get the script from?. Is it the same ejabberd.init I copied in /etc/init.d?.

Thank you,
Ivan Martinez

Boot sequences depend on distro.

Ivan Martinez wrote:

I learned that in order to make Linux start ejabberd during boot I need to have a script in a /etc/rc?.d folder, but where do I get the script from?. Is it the same ejabberd.init I copied in /etc/init.d?.

Depends on the Linux. That's true with Debian, the script goes in /etc/init.d/ and you place links in the /etc/rc? folders. Check the CentOS documentation, it's most likely a bit different since it's RH-based.

I returned to this issue

I returned to this issue successfully.

The init file doesn't support chkconfig because it's missing the required header:

http://www.linux.com/learn/tutorials/442412-managing-linux-daemons-with-...

Just adding the following to the beginning of ejabberd.init does the trick:

#!/bin/sh
#
# ejabberd Startup script for the ejabberd XMPP Server
#
# chkconfig: - 99 10
# description: ejabberd XMPP server

# Source function library.
. /etc/init.d/functions

set -o errexit
...

The numbers after chkconfig are boot-up and shutdown priorities, they may need tunning but those seem safe. I don't think chkconfig is distro-specific, I'll ask ejabberd developers to add this to the distribution package.

So after adding that to ejabberd.init, all that is left to do is:

su
cp ejabberd.init /etc/init.d/ejabberd
chmod +x /etc/init.d/ejabberd
/usr/sbin/groupadd -r ejabberd
/usr/sbin/useradd -g ejabberd -p ejabberd -r ejabberd
/sbin/chkconfig --add ejabberd
/sbin/chkconfig ejabberd on

Related ticket:

I got this error:

I got this error: /etc/init.d/ejabberd: line 29: $1: unbound variable

any idea?

thanks.

Syndicate content