summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-im/ejabberd/files/ejabberd-3.initd')
-rw-r--r--net-im/ejabberd/files/ejabberd-3.initd28
1 files changed, 26 insertions, 2 deletions
diff --git a/net-im/ejabberd/files/ejabberd-3.initd b/net-im/ejabberd/files/ejabberd-3.initd
index 1fe763b..bd9c61b 100644
--- a/net-im/ejabberd/files/ejabberd-3.initd
+++ b/net-im/ejabberd/files/ejabberd-3.initd
@@ -10,13 +10,37 @@ depend() {
}
start() {
+ if ejabberdctl status >/dev/null 2>&1; then
+ ewarn "ejabberd is already started (manually?)."
+ return 0
+ fi
ebegin "Starting ejabberd"
/usr/sbin/ejabberdctl ${EJABBERDCTL_OPT} start
eend $?
}
stop() {
+ if ejabberdctl status >/dev/null 2>&1 || test $? = 3; then
+ ewarn "ejabberd is already stopped (manually?)."
+ return 0
+ fi
ebegin "Stopping ejabberd"
- /usr/sbin/ejabberdctl stop
- eend $?
+ if /usr/sbin/ejabberdctl stop >/dev/null 2>&1; then
+ cnt=0
+ sleep 1
+ while ejabberdctl status >/dev/null 2>&1 || test $? = 1; do
+ echo -n .
+ cnt=`expr $cnt + 1`
+ if [ $cnt -ge 60 ] ; then
+ eend 1
+ break
+ fi
+ sleep 1
+ done
+ eend 0
+ else
+ eend 1
+ einfo "Please, run '/usr/sbin/ejabberdctl stop' to see what's going on."
+ fi
+ eend 0
}