[rabbitmq-discuss] running rabbitmqctl command by rabbitmq user

Andrea Rosa andrea.rosa at hp.com
Mon Sep 5 15:41:22 BST 2011


Hi

I'd like to create an automatic script to run rabbitmqctl command and I
need to run that script by rabbitmq user.
I tried to test some simple commands but it doesn't work for me. For
example if I run that command I have not got any output:

su - rabbitmq /usr/lib/rabbitmq/bin/rabbitmqctl list_users

and if I run the same command with "-p" option I have got an error:

su - rabbitmq /usr/lib/rabbitmq/bin/rabbitmqctl -p vhostname list_queues

-su: /root/.bash_profile: Permission denied
{error_logger,{{2011,9,5},{15,27,13}},{error,"Error when
reading /root/.erlang.cookie: eacces"},[]}
{error_logger,{{2011,9,5},{15,27,13}},crash_report,[[{initial_call,{auth,init,['Argument__1']}},{pid,<0.20.0>},{registered_name,[]},{error_info,{exit,{{error,"Error when reading /root/.erlang.cookie: eacces"},[{auth,init_cookie,0},{auth,init,1},{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]},[{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}},{ancestors,[net_sup,kernel_sup,<0.9.0>]},
{messages,[]},{links,[<0.18.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,377},{stack_size,24},{reductions,322}],[]]}
{error_logger,{{2011,9,5},{15,27,13}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{{error,"Error when reading /root/.erlang.cookie: eacces"},[{auth,init_cookie,0},{auth,init,1},{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}},{offender,[{pid,undefined},{name,auth},{mfa,{auth,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]}
{error_logger,{{2011,9,5},{15,27,13}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,shutdown},{offender,[{pid,undefined},{name,net_sup},{mfa,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]}
{error_logger,{{2011,9,5},{15,27,13}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]}
{"Kernel pid
terminated",application_controller,"{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller)
({application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}})


Is there some mistakes about sudo command?
--
Andrea



More information about the rabbitmq-discuss mailing list