From 6cfd36268fdbdab57396c77f0cf0faf6a32a64ca Mon Sep 17 00:00:00 2001 From: Peter Volkov Date: Fri, 28 May 2010 10:49:44 +0000 Subject: net-im/ejabberd: Make init script a bit more resistant. restart should now work. svn path=/; revision=428 --- net-im/ejabberd/Manifest | 2 +- net-im/ejabberd/files/ejabberd-3.initd | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/net-im/ejabberd/Manifest b/net-im/ejabberd/Manifest index b658859..8196e57 100644 --- a/net-im/ejabberd/Manifest +++ b/net-im/ejabberd/Manifest @@ -1,6 +1,6 @@ AUX 2.1.1-mod_statsdx.patch 66647 RMD160 b4563c29a827d1452ca70b68bb8cb1989e6104d6 SHA1 1b253ca6371e47773c82e5eab58d530fc171031a SHA256 85e8f7525d720c5fd202889e6511725a1d0edb185b333c586b524e9862023130 AUX ejabberd-3.confd 161 RMD160 3b2c2b2a871c42c75e854a3c592c0d399a5dd387 SHA1 01e72bda178e7bf26a66321c4330bbcc1607e540 SHA256 0296d3d281a321cd7380772c1d89a94e4a86f85b7f43bf9dc1af74935c2e6386 -AUX ejabberd-3.initd 369 RMD160 092cbf1d96a92f9a984cce9531c13ee3d022a033 SHA1 e74d6707719959786fd6fd46c4a9ba0714320661 SHA256 31daeafe003a0c13d51e8aaa9aa3c067ba3006e5edb1a47401a36c6d712be651 +AUX ejabberd-3.initd 923 RMD160 86016f6aecc1dc0b9528c32c2af2d036a2777c69 SHA1 1193ef0dc710c99be2babb3a0d06cf300c0bba51 SHA256 8560ac9a8802209956281105acf3f9f967c24fa864490a3f4e960f67de3b11ae DIST ejabberd-2.1.3.tar.gz 2243874 RMD160 c57672928e30f71ec66636dd5e76adb802f17b03 SHA1 77fdf18c0bb3b25cf9045e0c833ba4d82f180469 SHA256 602c6e4e742c4cab8594e9f049f08d0bf2125fa84af491e0ceb6d6f2f3854ef6 EBUILD ejabberd-2.1.3.ebuild 7774 RMD160 975a1bfd169e16d5a49ec63dc2cceee99a0ff472 SHA1 a7daf3602e1f2d21c8b378fa86768fec24a08b3c SHA256 b04f304afebcbdb647599e2ece361b7e8f10012e3da2891b1694c86e2035d555 MISC ChangeLog 8965 RMD160 325a316bff3eb3d4c61170084e81dcebef9ad71c SHA1 f9b2b52117fc679eaf49884eae4cd059e40bf8f8 SHA256 016e4ed223c68bd48b80c59d0780c7b7e68753046da8dd83c59fb6eeec83683a 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 } -- cgit v1.2.3-65-gdbad