Discussion:
[rabbitmq-discuss] rabbitmq-server init script
Nite
2011-03-09 12:38:49 UTC
Permalink
Hi Guys
I am installing rabbitmq-server from source. Where can I find a good init
script to put in /etc/init.d to run rabbitmq as a service?

Thanks.
Nite
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110309/c28662ae/attachment.htm>
Alexandru Scvortov
2011-03-09 13:51:51 UTC
Permalink
Hi,

There's one in
packaging/common/rabbitmq-server.init

Cheers,
Alex
Post by Nite
Hi Guys
I am installing rabbitmq-server from source. Where can I find a good init
script to put in /etc/init.d to run rabbitmq as a service?
Thanks.
Nite
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Nite
2011-03-09 18:55:32 UTC
Permalink
Weird, my build does not have a package directory.
Do I have to give any special build parameters?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110309/56e4a139/attachment.htm>
Alexandru Scvortov
2011-03-09 21:12:42 UTC
Permalink
Ah, no. That directory is in our source tree, but isn't included in the
source distribution. Here's the 2.3.1 one:
http://hg.rabbitmq.com/rabbitmq-server/file/rabbitmq_v2_3_1/packaging/common/rabbitmq-server.init

Cheers,
Alex
Post by Nite
Weird, my build does not have a package directory.
Do I have to give any special build parameters?
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
paul
2011-03-15 04:27:52 UTC
Permalink
just a note - the init script sets USER, but never uses the var
anywhere in the script. had a recurring issue with rabbitmq failing to
start after a reboot (centOS). merely adding the following after all
the vars are declared fixes the issue:

chown -R $USER:$USER $INIT_LOG_DIR

should probably be folded into the script...
Ah, no. ?That directory is in our source tree, but isn't included in the
?http://hg.rabbitmq.com/rabbitmq-server/file/rabbitmq_v2_3_1/packaging...
Cheers,
Alex
Post by Nite
Weird, my build does not have a package directory.
Do I have to give any special build parameters?
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-disc... at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Alexandru Scvor??ov
2011-03-16 12:16:53 UTC
Permalink
Hi,
Post by paul
just a note - the init script sets USER, but never uses the var
anywhere in the script.
You're right about USER. We don't use it anywhere.
Post by paul
had a recurring issue with rabbitmq failing to
start after a reboot (centOS). merely adding the following after all
chown -R $USER:$USER $INIT_LOG_DIR
That's interesting. Did you add some code to run rabbitmq as non-root?

What is your INIT_LOG_DIR? (did you change it to a location that gets
wiped on restart?)

I see we don't automatically `mkdir $INIT_LOG_DIR` in the init script.
How are you creating it?

Cheers,
Alex
Post by paul
just a note - the init script sets USER, but never uses the var
anywhere in the script. had a recurring issue with rabbitmq failing to
start after a reboot (centOS). merely adding the following after all
chown -R $USER:$USER $INIT_LOG_DIR
should probably be folded into the script...
Ah, no. ?That directory is in our source tree, but isn't included in the
?http://hg.rabbitmq.com/rabbitmq-server/file/rabbitmq_v2_3_1/packaging...
Cheers,
Alex
Post by Nite
Weird, my build does not have a package directory.
Do I have to give any special build parameters?
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-disc... at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
paul
2011-03-16 18:28:20 UTC
Permalink
On Mar 16, 5:16?am, Alexandru Scvor??ov <alexan... at rabbitmq.com>
Post by paul
chown -R $USER:$USER $INIT_LOG_DIR
That's interesting. ?Did you add some code to run rabbitmq as non-root?
nope.
What is your INIT_LOG_DIR? (did you change it to a location that gets
wiped on restart?)
i installed from the RPM, which created the rabbitmq log directory in
the appropriate place, and with the appropriate ownership as
rabbitmq:rabbitmq - it's just that on restart apparently the logs
would be created owned by root which would block startup.
I see we don't automatically `mkdir $INIT_LOG_DIR` in the init script.
How are you creating it?
as above - was created at /var/log/rabbitmq by the rpm.
Alexandru Scvorţov
2011-03-17 10:29:55 UTC
Permalink
I'm having trouble reproducing this.

On a fresh Centos install, the RPM does what it's supposed to do (and what
you say it does). In /var/log/rabbitmq, there are some log files owned by
root and some owned by rabbitmq, but the root files are only ever accessed
by the init script, and that should be fine.

Is this what you're seeing?

Starting rabbitmq-server: /etc/init.d/rabbitmq-server: line 43:
/var/log/rabbitmq/startup_log: Permission denied
TIMEOUT - check /var/log//rabbitmq/startup_{log,err}
rabbitmq_server.

If so, are you starting the service as a non-root user?

Cheers,
Alex
Post by paul
On Mar 16, 5:16?am, Alexandru Scvor??ov <alexan... at rabbitmq.com>
Post by paul
chown -R $USER:$USER $INIT_LOG_DIR
That's interesting. ?Did you add some code to run rabbitmq as non-root?
nope.
What is your INIT_LOG_DIR? (did you change it to a location that gets
wiped on restart?)
i installed from the RPM, which created the rabbitmq log directory in
the appropriate place, and with the appropriate ownership as
rabbitmq:rabbitmq - it's just that on restart apparently the logs
would be created owned by root which would block startup.
I see we don't automatically `mkdir $INIT_LOG_DIR` in the init script.
How are you creating it?
as above - was created at /var/log/rabbitmq by the rpm.
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
paul
2011-03-17 18:56:17 UTC
Permalink
Post by Alexandru Scvorţov
I'm having trouble reproducing this.
On a fresh Centos install, the RPM does what it's supposed to do (and what
you say it does). ?In /var/log/rabbitmq, there are some log files owned by
root and some owned by rabbitmq, but the root files are only ever accessed
by the init script, and that should be fine.
Is this what you're seeing?
? /var/log/rabbitmq/startup_log: Permission denied
? TIMEOUT - check /var/log//rabbitmq/startup_{log,err}
? rabbitmq_server.
i believe that's the error, yeah.
Post by Alexandru Scvorţov
If so, are you starting the service as a non-root user?
no, it just starts from the init script run as user root - the only
changes i made to the init script are as described in my previous
message. but after it starts up, the processes are running under
rabbitmq ownership -


[root at app06 rabbitmq]# ps -ecf|grep rabb
rabbitmq 2545 1 TS 24 Mar14 ? 00:00:00 /usr/local/lib/
erlang/erts-5.8.2/bin/epmd -daemon
rabbitmq 2556 1 TS 21 Mar14 ? 00:02:56 /usr/local/lib/
erlang/erts-5.8.2/bin/beam.smp -W w -K true -A30 -P 1048576 -- -root /
usr/local/lib/erlang -progname erl -- -home /var/lib/rabbitmq -- -
noshell -noinput -sname rabbit at app06 -boot /var/lib/rabbitmq/mnesia/
rabbit at app06-plugins-expand/rabbit -kernel inet_default_listen_options
[{nodelay,true}] -kernel inet_default_connect_options [{nodelay,true}]
-sasl errlog_type error -kernel error_logger {file,"/var/log/rabbitmq/
rabbit at app06.log"} -sasl sasl_error_logger {file,"/var/log/rabbitmq/
rabbit at app06-sasl.log"} -os_mon start_cpu_sup true -os_mon
start_disksup false -os_mon start_memsup false -mnesia dir "/var/lib/
rabbitmq/mnesia/rabbit at app06" -noshell -noinput
rabbitmq 2625 2556 TS 24 Mar14 ? 00:00:00 inet_gethost 4
rabbitmq 2626 2625 TS 21 Mar14 ? 00:00:00 inet_gethost 4
rabbitmq 2627 2556 TS 21 Mar14 ? 00:00:00 /usr/local/lib/
erlang/lib/os_mon-2.2.5/priv/bin/cpu_sup


without the change in ownership of the logfiles, it starts
successfully (seemingly) but only a couple of procs are left running
(i don't remember which, sorry - i think just the first one listed
above)

Nite
2011-03-09 23:29:42 UTC
Permalink
Thanks very much, Alex.

--
Nite
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110309/5bc29d35/attachment-0001.htm>
Loading...