[packages/pacemaker/pacemaker-1_1] - PLD init script and systemd service file added - Release: 1.1

draenog draenog at pld-linux.org
Thu Jul 5 02:41:24 CEST 2012


commit d45bf2c6fd8386294a120d6008a2f392a484d953
Author: Jacek Konieczny <jajcus at pld-linux.org>
Date:   Wed Jul 4 19:58:44 2012 +0000

    - PLD init script and systemd service file added
    - Release: 1.1
    
    Changed files:
        pacemaker.init -> 1.1.2.1
        pacemaker.service -> 1.1.2.1
        pacemaker.spec -> 1.17.2.9

 pacemaker.init    | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 pacemaker.service | 23 ++++++++++++++
 pacemaker.spec    | 17 +++++-----
 3 files changed, 124 insertions(+), 8 deletions(-)
---
diff --git a/pacemaker.init b/pacemaker.init
new file mode 100644
index 0000000..746230a
--- /dev/null
+++ b/pacemaker.init
@@ -0,0 +1,92 @@
+#!/bin/sh
+#
+# pacemaker	Pacemaker Cluster Manager for the Corosync stack
+#
+# chkconfig: 2345 23 77
+# description: Pacemaker Cluster Manager
+# processname: pacemakerd
+#
+### BEGIN INIT INFO
+# Provides:		pacemaker
+# Required-Start:	$corosync
+# Required-Stop:	$corosync
+# Default-Start:
+# Default-Stop:
+# Short-Description:	Starts and stops Pacemaker Cluster Manager.
+# Description:		Starts and stops Pacemaker Cluster Manager.
+### END INIT INFO
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+[ -f /etc/sysconfig/pacemaker ] && . /etc/sysconfig/pacemaker
+
+start() {
+	# Check if the service is already running?
+	if [ -f /var/lock/subsys/pacemaker ]; then
+		msg_already_running "Pacemaker Cluster Manager"
+		return
+	fi
+	if grep -q nocluster /proc/cmdline ; then
+		show "Disabled on boot"
+		RETVAL=1
+		return
+	fi
+
+	msg_starting "Pacemaker Cluster Manager"
+	daemon /usr/sbin/pacemakerd --pid-file=/var/run/pacemakerd.pid
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/pacemaker
+}
+
+stop() {
+	if [ ! -f /var/lock/subsys/pacemaker ]; then
+		msg_not_running "Pacemaker Cluster Manager"
+		return
+	fi
+
+	# Stop daemons.
+	msg_stopping "Pacemaker Cluster Manager"
+	killproc /usr/sbin/pacemakerd
+	rm -f /var/lock/subsys/pacemaker
+}
+
+condrestart() {
+	if [ ! -f /var/lock/subsys/pacemaker ]; then
+		msg_not_running "Pacemaker Cluster Manager"
+		RETVAL=$1
+		return
+	fi
+
+	stop
+	start
+}
+
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	stop
+   	sleep 5
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status pacemaker pacemakerd
+	RETVAL=$?
+	;;
+*)
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+	exit 3
+	;;
+esac
+exit $RETVAL
diff --git a/pacemaker.service b/pacemaker.service
new file mode 100644
index 0000000..e23f11c
--- /dev/null
+++ b/pacemaker.service
@@ -0,0 +1,23 @@
+[Unit]
+Description=Pacemaker High Availability Cluster Manager for Corosync stack
+
+After=corosync.target
+Requires=corosync.target
+
+[Install]
+WantedBy=multi-user.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/pacemakerd.pid
+KillMode=process
+SysVStartPriority=23
+EnvironmentFile=-/etc/sysconfig/pacemaker
+ExecStart=/usr/sbin/pacemakerd --pid-file=/var/run/pacemakerd.pid
+
+# Pacemaker can only exit after all managed services have shut down
+# A HA database could conceivably take even longer than this 
+TimeoutSec=30min
+
+# Restart options include: no, on-success, on-failure, on-abort or always
+Restart=on-failure
diff --git a/pacemaker.spec b/pacemaker.spec
index 5a0071a..c2f6a22 100644
--- a/pacemaker.spec
+++ b/pacemaker.spec
@@ -1,19 +1,18 @@
 #
-# TODO:
-#	- optional support for complete openais stack (corosync is often enough)
-
 %bcond_without	corosync	# build with corosync stack
 %bcond_without	heartbeat	# build without heartbeat stack
 Summary:	The scalable High-Availability cluster resource manager
 Name:		pacemaker
 Version:	1.1.7
-Release:	1
+Release:	1.1
 License:	GPL v2+; LGPL v2.1+
 Group:		Applications/System
 # https://github.com/ClusterLabs/pacemaker/tarball/Pacemaker-%{version}
 Source0:	ClusterLabs-pacemaker-Pacemaker-%{version}-0-gee0730e.tar.gz
 # Source0-md5:	61076a946cf2ba549dce1458e2ef76e2
 Source1:	%{name}.tmpfiles
+Source2:	%{name}.init
+Source3:	%{name}.service
 Patch0:		%{name}-ncurses.patch
 Patch1:		%{name}-libs.patch
 Patch2:		%{name}-awk.patch
@@ -53,9 +52,9 @@ BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 %define skip_post_check_so libpe_status.so.*
 
 %description
-Pacemaker makes use of your cluster infrastructure (either OpenAIS or
-Heartbeat) to stop, start and monitor the health of the services (aka.
-resources) you want the cluster to provide.
+Pacemaker makes use of your cluster infrastructure (either 
+Corosync/OpenAIS or Heartbeat) to stop, start and monitor the health
+of the services (aka.  resources) you want the cluster to provide.
 
 It can do this for clusters of practically any size and comes with a
 powerful dependency model that allows the administrator to accurately
@@ -138,7 +137,7 @@ Static Pacemaker libraries.
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/usr/lib/tmpfiles.d,/etc/rc.d}
+install -d $RPM_BUILD_ROOT{/usr/lib/tmpfiles.d,/etc/rc.d/init.d,%{systemdunitdir}}
 
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
@@ -147,6 +146,8 @@ rm -r $RPM_BUILD_ROOT%{_docdir}/pacemaker
 rm $RPM_BUILD_ROOT%{_libdir}/heartbeat/plugins/RAExec/*.{la,a}
 
 install %{SOURCE1} $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/%{name}.conf
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
 
 %clean
 rm -rf $RPM_BUILD_ROOT


More information about the test mailing list