Add systemd unit files for corosync and corosync-notifyd

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
This commit is contained in:
Angus Salkeld 2011-08-08 21:01:52 +10:00
parent 1957865dd6
commit 6fa114ac8d
6 changed files with 56 additions and 4 deletions

View File

@ -272,6 +272,11 @@ AC_ARG_ENABLE([augeas],
[ enable_augeas="no" ])
AM_CONDITIONAL(INSTALL_AUGEAS, test x$enable_augeas = xyes)
AC_ARG_ENABLE([systemd],
[ --enable-systemd : Install systemd service files],,
[ enable_systemd="no" ])
AM_CONDITIONAL(INSTALL_SYSTEMD, test x$enable_systemd = xyes)
AC_ARG_WITH([initddir],
[ --with-initddir=DIR : path to init script directory. ],
[ INITDDIR="$withval" ],
@ -441,6 +446,9 @@ fi
if test "x${enable_augeas}" = xyes; then
PACKAGE_FEATURES="$PACKAGE_FEATURES augeas"
fi
if test "x${enable_systemd}" = xyes; then
PACKAGE_FEATURES="$PACKAGE_FEATURES systemd"
fi
if test "x${enable_snmp}" = xyes; then
SNMPCONFIG=""

View File

@ -11,6 +11,7 @@
%bcond_with snmp
%bcond_with dbus
%bcond_with rdma
%bcond_with systemd
Name: corosync
Summary: The Corosync Cluster Engine and Application Programming Interfaces
@ -46,6 +47,9 @@ BuildRequires: net-snmp-devel
%if %{with dbus}
BuildRequires: dbus-devel
%endif
%if %{with systemd}
BuildRequires: systemd-units
%endif
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
@ -82,6 +86,9 @@ export rdmacm_LIBS=-lrdmacm \
%endif
%if %{with rdma}
--enable-rdma \
%endif
%if %{with systemd}
--enable-systemd \
%endif
--with-initddir=%{_initrddir}
@ -146,8 +153,13 @@ fi
%if %{with snmp}
%{_datadir}/snmp/mibs/COROSYNC-MIB.txt
%endif
%if %{with systemd}
%{_unitdir}/corosync.service
%{_unitdir}/corosync-notifyd.service
%else
%{_initrddir}/corosync
%{_initrddir}/corosync-notifyd
%endif
%dir %{_libexecdir}/lcrso
%{_libexecdir}/lcrso/coroparse.lcrso
%{_libexecdir}/lcrso/objdb.lcrso

2
init/.gitignore vendored
View File

@ -1,2 +1,4 @@
generic
notifyd
corosync.service
corosync-notifyd.service

View File

@ -34,9 +34,14 @@
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = generic.in notifyd.in
EXTRA_DIST = generic.in notifyd.in corosync.service.in corosync-notifyd.service.in
if INSTALL_SYSTEMD
systemdconfdir = /lib/systemd/system
systemdconf_DATA = corosync.service corosync-notifyd.service
else
target_INIT = generic notifyd
endif
%: %.in Makefile
rm -f $@-t $@
@ -46,14 +51,15 @@ target_INIT = generic notifyd
-e 's#@''INITDDIR@#$(INITDDIR)#g' \
-e 's#@''LOCALSTATEDIR@#$(localstatedir)#g' \
$< > $@-t
chmod 0755 $@-t
mv $@-t $@
all-local: $(target_INIT)
all-local: $(target_INIT) $(systemdconf_DATA)
clean-local:
rm -rf $(target_INIT)
rm -rf $(target_INIT) $(systemdconf_DATA)
if INSTALL_SYSTEMD
else
install-exec-local:
$(INSTALL) -d $(DESTDIR)/$(INITDDIR)
$(INSTALL) -m 755 generic $(DESTDIR)/$(INITDDIR)/corosync
@ -62,3 +68,4 @@ install-exec-local:
uninstall-local:
cd $(DESTDIR)/$(INITDDIR) && \
rm -f corosync corosync-notifyd
endif

View File

@ -0,0 +1,11 @@
[Unit]
Description=Corosync Dbus and snmp notifier
Wants=corosync.service
[Service]
EnvironmentFile=@SYSCONFIGDIR@/corosync-notifyd
ExecStart=@SBINDIR@/corosync-notifyd -f $OPTIONS
Type=simple
[Install]
WantedBy=multi-user.target

12
init/corosync.service.in Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Corosync Cluster Engine
ConditionKernelCommandLine=!nocluster
#Conflicts=cman.service
[Service]
ExecStart=@SBINDIR@/corosync
Type=forking
#RestartSec=90s
[Install]
WantedBy=multi-user.target