0

I have installed ejabbered from source code into centos 7 it is running fine but now problem is only how to auto start it with system. I have tried startup application, rc.local file method but all failed is there any other way to run ejabbered with system ?

Edit:- I download ejabberd.service file and rename it ejabberd.service and copied it to /etc/systemd/system/ and run this command systemctl enable ejabberd.service to enable it but still ejabberd is not running with system.

  • Write a `systemd` service file for it. – Sven Sep 19 '16 at 17:43
  • can you please explain how to write one ? – Varun Naharia Sep 19 '16 at 17:45
  • This is widely documented. Search for it, learn, try and come back if you have specific problems. – Sven Sep 19 '16 at 17:46
  • CentOS 7 uses [systemd](https://www.freedesktop.org/wiki/Software/systemd/) and you need service unit instead of an init script. A [systemd unit template](https://github.com/processone/ejabberd/blob/master/ejabberd.service.template) is already included in the source tree. – HBruijn Sep 19 '16 at 18:32
  • I used your suggested method but it doesn't work either, I updated my question. – Varun Naharia Sep 21 '16 at 02:34

2 Answers2

1

I was able to get this running using ejabberd.service
Inside this file, I modified the path so @ctlscriptpath@ was replaced with the actual path of my installation.
I was then able to start and check on the status of the service.
If you have already tried running the service with the original file, you will need to run: systemctl daemon-reload before running: systemctl start ejabberd

In my case it was: /opt/ejabberd-17.11/bin/ejabberdctl rather than: @ctlscriptpath@/ejabberdctl
(make sure you change the path in each location!!)

It is entirely possible there is another way to replace the variable in a more proper way (I didn't find the more proper way in few minutes of googling, I hope to come back to this later.)

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
James H
  • 11
  • 1
-2

On a *nix system, if you want ejabberd to be started as daemon at boot time, copy ejabberd.init from the ’bin’ directory to something like /etc/init.d/ejabberd (depending on your distribution).

Create a system user called ejabberd, give it write access to the directories database/ and logs/, and set that as home; the script will start the server with that user. Then you can call /etc/inid.d/ejabberd start as root to start the server.