summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Wragg <dpw@lshift.net>2009-08-11 12:14:37 +0100
committerDavid Wragg <dpw@lshift.net>2009-08-11 12:14:37 +0100
commit6e279cd7b249aaf648d15bce65e9429d3c3f316f (patch)
treeff6d1ddbdc9ef92080e18e7111b245b6fa26a5ac
parentea67ca82ef894396adc69ee6f7bdb7fa0d6f2e92 (diff)
downloadrabbitmq-server-6e279cd7b249aaf648d15bce65e9429d3c3f316f.tar.gz
When stopping rabbitmq server, kill any rabbitmq-owned epmd process
epmd is the Erlang Port Mapper Daemon, which maps Erlang node names to TCP port numbers. It is shared by all users on a system, and started automatically by the Erlang start-up script if not already running. As a result, epmd will often be started when the rabbitmq server starts, and so will be run as the rabbitmq user. This process will linger even after the rabbitmq server is stopped. This can have surprising consequences: The deluser program in Debian Sid checks whether any processes owned by the given user are running, and will fail if so. This change addresses the problem in this init script. When stopping the rabbitmq server, it will also kill any rabbitmq-owned epmd process.
-rw-r--r--packaging/RPMS/Fedora/init.d8
-rw-r--r--packaging/debs/Debian/debian/init.d5
2 files changed, 9 insertions, 4 deletions
diff --git a/packaging/RPMS/Fedora/init.d b/packaging/RPMS/Fedora/init.d
index 77a6a89a..21019c70 100644
--- a/packaging/RPMS/Fedora/init.d
+++ b/packaging/RPMS/Fedora/init.d
@@ -62,10 +62,12 @@ stop_rabbitmq () {
if [ $RETVAL = 0 ] ; then
$DAEMON stop_all > /var/log/rabbitmq/shutdown_log 2> /var/log/rabbitmq/shutdown_err
RETVAL=$?
- if [ $RETVAL != 0 ] ; then
- echo FAILED - check /var/log/rabbitmq/shutdown_log, _err
- else
+ if [ $RETVAL = 0 ] ; then
+ # Try to stop epmd if run by the rabbitmq user
+ pkill -u rabbitmq epmd || :
rm -rf $LOCK_FILE
+ else
+ echo FAILED - check /var/log/rabbitmq/shutdown_log, _err
fi
else
echo No nodes running
diff --git a/packaging/debs/Debian/debian/init.d b/packaging/debs/Debian/debian/init.d
index a35a60ec..4a7909c5 100644
--- a/packaging/debs/Debian/debian/init.d
+++ b/packaging/debs/Debian/debian/init.d
@@ -53,7 +53,10 @@ stop_rabbitmq () {
if [ $RETVAL = 0 ] ; then
$DAEMON stop_all > /var/log/rabbitmq/shutdown_log 2> /var/log/rabbitmq/shutdown_err
RETVAL=$?
- if [ $RETVAL != 0 ] ; then
+ if [ $RETVAL = 0 ] ; then
+ # Try to stop epmd if run by the rabbitmq user
+ pkill -u rabbitmq epmd || :
+ else
echo FAILED - check /var/log/rabbitmq/shutdown_log, _err
fi
else