Hi,
attached diff adds an rc script for net/ejabberd.
note that on ejabberd stop, the epmd name service daemon, that automatically
gets started when starting ejabberd, keeps running. However, the main ejabberd
process gets stopped.
I tried to kill this epmd in rc_stop, but then I recognized, that after it
calls
rc_stop, rc_check is called in order to make sure the daemon is indeed stopped.
However, running ejabberdctl again in the rc_check, restarted the just
killed epmd :(
the ejabberd processes look like this when they are running:
ps auxwww | grep ejabberd
_ejabberd 28013 0.0 0.0 440 980 ?? S 3:53PM 0:00.19
/usr/local/lib/erlang/erts-5.9.2/bin/epmd -daemon
_ejabberd 12207 0.0 2.7 71892 55836 ?? I 4:09PM 0:04.35
/usr/local/lib/erlang/erts-5.9.2/bin/beam.smp -P 250000 -- -root
/usr/local/lib/erlang -progname erl -- -home /var/db/ejabberd -- -sname
ejabberd@localhost -noshell -noinput -noshell -noinput -pa
/usr/local/lib/ejabberd/ebin -mnesia dir "/var/db/ejabberd/ejabberd" -kernel
inet_dist_use_interface {127,0,0,1} -s ejabberd -sasl sasl_error_logger
{file,"/var/log/ejabberd/erlang.log"} -smp auto start start
_ejabberd 15360 0.0 0.1 680 1128 ?? I 4:09PM 0:00.00 inet_gethost
4
_ejabberd 47 0.0 0.1 604 1308 ?? Is 4:09PM 0:00.01 inet_gethost
4
I specify daemon_flags, "--node ejabberd@localhost" that translate into the
--sname ejabberd@localhost parameter seen above.
so just grepping for the process in rc_check is not that sufficient, since
it might find instances running, with wrong parameters :(
Don't know if there is a better way how to also kill the epmd.
Hoping on input/ideas, how to get rid of the epmd on rc_stop too, or else
if the above could be considered as OK?
cheers,
Sebastian
Index: Makefile
===================================================================
RCS file: /cvs/ports/net/ejabberd/Makefile,v
retrieving revision 1.33
diff -u -r1.33 Makefile
--- Makefile 27 Oct 2014 15:44:20 -0000 1.33
+++ Makefile 9 Dec 2014 14:58:43 -0000
@@ -4,7 +4,7 @@
V= 2.1.12
DISTNAME= ejabberd-$V
-REVISION= 1
+REVISION= 2
CATEGORIES= net
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/ejabberd/pkg/PLIST,v
retrieving revision 1.14
diff -u -r1.14 PLIST
--- pkg/PLIST 24 Jan 2014 19:05:29 -0000 1.14
+++ pkg/PLIST 9 Dec 2014 14:58:43 -0000
@@ -275,3 +275,7 @@
@sample /var/log/ejabberd/
@sample /var/db/ejabberd/
@sample /var/db/ejabberd/ejabberd/
+@mode
+@owner
+@group
+@rcscript ${RCDIR}/ejabberd
Index: pkg/ejabberd.rc
===================================================================
RCS file: pkg/ejabberd.rc
diff -N pkg/ejabberd.rc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/ejabberd.rc 9 Dec 2014 14:58:43 -0000
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# $OpenBSD$
+
+daemon="${TRUEPREFIX}/sbin/ejabberdctl"
+daemon_user="_ejabberd"
+
+. /etc/rc.d/rc.subr
+
+rc_start() {
+ ${daemon} ${daemon_flags} start 2>>/dev/null >>/dev/null
+}
+
+rc_stop() {
+ ${daemon} ${daemon_flags} stop 2>>/dev/null >>/dev/null
+
+}
+
+rc_check() {
+ ${daemon} ${daemon_flags} status 2>>/dev/null >>/dev/null
+}
+
+rc_reload=NO
+
+rc_cmd $1