Accepting request 162588 from network:messaging:amqp

- Change init script to properly daemonize (patch by jdsn) (bnc#807540)

- Added systemd .service file

OBS-URL: https://build.opensuse.org/request/show/162588
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rabbitmq-server?expand=0&rev=8
This commit is contained in:
Stephan Kulow 2013-04-05 05:37:02 +00:00 committed by Git OBS Bridge
commit bbe1e97ea6
4 changed files with 54 additions and 3 deletions

View File

@ -1,3 +1,13 @@
------------------------------------------------------------------
Wed Apr 3 12:00:36 UTC 2013 - dmueller@suse.com
- Change init script to properly daemonize (patch by jdsn) (bnc#807540)
-------------------------------------------------------------------
Sun Mar 17 10:04:09 UTC 2013 - matwey.kornilov@gmail.com
- Added systemd .service file
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Mar 13 11:28:33 CET 2013 - berendt@b1-systems.de Wed Mar 13 11:28:33 CET 2013 - berendt@b1-systems.de

View File

@ -53,8 +53,8 @@ start_rabbitmq () {
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
return 0 return 0
else else
setsid sh -c "RABBITMQ_PID_FILE=$PID_FILE $DAEMON > \ export RABBITMQ_PID_FILE=$PID_FILE
${INIT_LOG_DIR}/startup_log 2> ${INIT_LOG_DIR}/startup_err" & startproc -l ${INIT_LOG_DIR}/startup_log -p $PID_FILE $DAEMON
$CONTROL wait $PID_FILE >/dev/null 2>&1 $CONTROL wait $PID_FILE >/dev/null 2>&1
rc=$? rc=$?
case "$rc" in case "$rc" in

17
rabbitmq-server.service Normal file
View File

@ -0,0 +1,17 @@
[Unit]
Description=RabbitMQ broker
After=syslog.target network.target
[Service]
Type=simple
User=rabbitmq
Group=rabbitmq
Environment=RABBITMQ_PID_FILE=/var/run/rabbitmq/pid
WorkingDirectory=/var/lib/rabbitmq
ExecStart=/usr/sbin/rabbitmq-server
ExecStartPost=/usr/sbin/rabbitmqctl wait /var/run/rabbitmq/pid
ExecStop=/usr/sbin/rabbitmqctl stop
ExecStopPost=/usr/bin/rm /var/run/rabbitmq/pid
[Install]
WantedBy=multi-user.target

View File

@ -1,7 +1,7 @@
# #
# spec file for package rabbitmq-server # spec file for package rabbitmq-server
# #
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -37,6 +37,7 @@ Source2: rabbitmq-script-wrapper
Source3: rabbitmq-server.logrotate Source3: rabbitmq-server.logrotate
Source4: rabbitmq-server.ocf Source4: rabbitmq-server.ocf
Source5: rabbitmq-server.sysconfig Source5: rabbitmq-server.sysconfig
Source6: rabbitmq-server.service
Patch0: no-nmap.patch Patch0: no-nmap.patch
Patch1: no-remove-common.patch Patch1: no-remove-common.patch
BuildRequires: erlang BuildRequires: erlang
@ -57,6 +58,11 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(pre): pwdutils Requires(pre): pwdutils
Requires(pre): %fillup_prereq Requires(pre): %fillup_prereq
Requires(pre): %insserv_prereq Requires(pre): %insserv_prereq
%if 0%{?suse_version} > 1140
BuildRequires: systemd
%{?systemd_requires}
%define have_systemd 1
%endif
# Do not use noarch since the Erlang packaging does not really allow that # Do not use noarch since the Erlang packaging does not really allow that
#BuildArch: noarch #BuildArch: noarch
@ -111,6 +117,9 @@ mkdir -p %{buildroot}%{_sbindir}
ln -sf %{_initddir}/rabbitmq-server %{buildroot}%{_sbindir}/rcrabbitmq-server ln -sf %{_initddir}/rabbitmq-server %{buildroot}%{_sbindir}/rcrabbitmq-server
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates/ mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates/
install -p -D -m 644 %{SOURCE5} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.rabbitmq-server install -p -D -m 644 %{SOURCE5} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.rabbitmq-server
%if 0%{?have_systemd}
install -p -D -m 644 %{SOURCE6} %{buildroot}%{_unitdir}/%{name}.service
%endif
# Install wrapper scripts # Install wrapper scripts
%define _rabbit_wrapper %{_builddir}/`basename %{SOURCE2}` %define _rabbit_wrapper %{_builddir}/`basename %{SOURCE2}`
@ -155,17 +164,29 @@ getent passwd rabbitmq >/dev/null || useradd -r -g rabbitmq \
-d %{_localstatedir}/lib/rabbitmq \ -d %{_localstatedir}/lib/rabbitmq \
-s /sbin/nologin \ -s /sbin/nologin \
-c "user for RabbitMQ messaging server" rabbitmq -c "user for RabbitMQ messaging server" rabbitmq
%if 0%{?have_systemd}
%service_add_pre %{name}.service
%endif
exit 0 exit 0
%post %post
%fillup_and_insserv rabbitmq-server %fillup_and_insserv rabbitmq-server
%if 0%{?have_systemd}
%service_add_post %{name}.service
%endif
%preun %preun
%stop_on_removal rabbitmq-server %stop_on_removal rabbitmq-server
%if 0%{?have_systemd}
%service_del_preun %{name}.service
%endif
%postun %postun
%restart_on_update rabbitmq-server %restart_on_update rabbitmq-server
%insserv_cleanup %insserv_cleanup
%if 0%{?have_systemd}
%service_del_postun %{name}.service
%endif
%files -f ../filelist.%{name}.rpm %files -f ../filelist.%{name}.rpm
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -178,6 +199,9 @@ exit 0
%{_rabbit_erllibdir} %{_rabbit_erllibdir}
%{_initddir}/rabbitmq-server %{_initddir}/rabbitmq-server
%{_sbindir}/rcrabbitmq-server %{_sbindir}/rcrabbitmq-server
%if 0%{?have_systemd}
%{_unitdir}/%{name}.service
%endif
%dir /usr/lib/ocf %dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d %dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/rabbitmq %dir /usr/lib/ocf/resource.d/rabbitmq