[rabbitmq-discuss] running rabbitmqctl command by rabbitmq user

Matthew Sackman matthew at rabbitmq.com
Mon Sep 5 15:46:26 BST 2011

Hi Andrea,

On Mon, Sep 05, 2011 at 03:41:22PM +0100, Andrea Rosa wrote:
> I'd like to create an automatic script to run rabbitmqctl command and I
> need to run that script by rabbitmq user.

As you can see from looking at /usr/sbin/rabbitmqctl, under linux, we
use somithng like

su rabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/${SCRIPT} ${CMDLINE}"

For what it's worth, we've been round the houses several times with sudo
and su, and the fact that on some platforms one will retain the
environment whilst the other doesn't etc etc. It's all a bit
platform-specific unfortunately.

I hope that helps,


More information about the rabbitmq-discuss mailing list