Re: ejabberd

From: Colin Booth <cathexis_at_gmail.com>
Date: Thu, 25 Sep 2014 22:31:54 -0700

On Thu, Sep 25, 2014 at 6:51 PM, Alex Efros <powerman_at_powerman.name> wrote:
> Hi!
>
> On Fri, Sep 26, 2014 at 01:26:52AM +0000, James Powell wrote:
>> ejabberd services could be started as such. Here's a method you could
>> use that I've deduced from the documentation to create an ejabberd
>> service:
>
> Did you actually tested this setup?
>
>> cat > /etc/sv/ejabberd/run << "EOF"
>> #!/bin/sh
>> exec 2>&1
>> exec ejabberdctl start
>> EOF
>
> This shouldn't work because `ejabberdctl start` run ejabbed in background
> and exits immediately…
>
>> cat > /etc/sv/ejabberd/finish << "EOF"
>> #!/bin/sh
>> exec ejabberdctl stop
>> EOF
>
> …and then this should result in stopping just-started-in-background ejabberd.
Yeah, that's not going to work. `exec ejabberctl start' will try to
supervise the
control program which returns immediately and will then fire stop. I guess you
could do something like:
#!/bin/sh
ejabberctl start
exec horrible_listener_script.sh

Where `horrible_listener_script.sh' is something super dirty like:
`while : ; do nc localhost 4369 ; sleep 1; done'

That doesn't fix your logging problem though.
>
>> cat > /etc/sv/ejabberd/log/run << "EOF"
>> #!/bin/sh
>> if [ -d /var/log/ejabber ]; then
>> mkdir -p /var/log/ejabber
>> fi
>> exec svlogd -tt /var/log/ejabberd
>> EOF
>
> This shouldn't work - it will start, but won't write anything into log
> because ejabberd started in background by `ejabberdctl start` won't output
> anything to STDOUT but instead write into two files:
> /var/log/jabber/erlang.log and /var/log/jabber/ejabberd.log.

For logging, you could make erlang.log and/or ejabberd.log a fifo, then use a
multilog-style logger service like so:
/etc/sv/ejabberlogger/run
#!/bin/sh
exec < /var/log/jabber/ejabberd.log
exec chpst ejabberd svlogd /var/log/jabber

Which will take logs from the fifo that ejabberd is happily writing to, and
write them back as svlogd managed log files. Again, kinda dirty but
should do the trick.
>
> At least that's true for ejabberdctl script in Gentoo Linux - I've no idea
> is it vanilla or Gentoo-patched (I'll attach it, so you can compare it
> with your own, just in case yours works differently). Another possible
> reason is different versions of ejabberd - I'm using 2.1.13.
>
> --
> WBR, Alex.

Are you stuck with the erlang jabber server? It seems like a lot of the issues
are related to erlang daemons being weird. That said, I don't have much
experience with erlang beyond fighting rabbitmq at work so there's probably
a better way within the erlang space that I don't know about.

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
Received on Fri Sep 26 2014 - 05:31:54 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:18 UTC