public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* fence-agents: master - fence_scsi: improve init script
@ 2009-01-09 12:53 Fabio M. Di Nitto
0 siblings, 0 replies; only message in thread
From: Fabio M. Di Nitto @ 2009-01-09 12:53 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=f5319f77cdb5dff32f55cbd9fbac5530e74fcece
Commit: f5319f77cdb5dff32f55cbd9fbac5530e74fcece
Parent: c6e55b3eafd591a33ef7ee6ce2a2271988a521ec
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate: Fri Jan 9 12:09:52 2009 +0100
Committer: Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Fri Jan 9 13:52:30 2009 +0100
fence_scsi: improve init script
based on Marian Marinov submission for gfs2 init script,
simplify the init script distro overrides to make the script
easily readable again and also easier to write.
Set also a secure PATH.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
fence/agents/scsi/Makefile | 1 +
fence/agents/scsi/scsi_reserve.in | 39 ++++++++++++++++++-------------------
2 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/fence/agents/scsi/Makefile b/fence/agents/scsi/Makefile
index dc5f2d9..40efe37 100644
--- a/fence/agents/scsi/Makefile
+++ b/fence/agents/scsi/Makefile
@@ -14,5 +14,6 @@ $(NOTIFYD): $(S)/$(NOTIFYD).in
$(INITDT): $(S)/$(INITDT).in
cat $(S)/$(INITDT).in | sed \
+ -e 's#@SBINDIR@#${sbindir}#g' \
-e 's#@INITDDIR@#${initddir}#g' \
> $(INITDT)
diff --git a/fence/agents/scsi/scsi_reserve.in b/fence/agents/scsi/scsi_reserve.in
index c5a9790..cb30444 100644
--- a/fence/agents/scsi/scsi_reserve.in
+++ b/fence/agents/scsi/scsi_reserve.in
@@ -15,14 +15,25 @@
# Description: start/stop persistent reservation service for lvm
### END INIT INFO
+# set secure PATH
+PATH="/bin:/usr/bin:/sbin:/usr/sbin:@SBINDIR@"
+
+success()
+{
+ echo -ne "[ OK ]\r"
+}
+
+failure()
+{
+ echo -ne "[FAILED]\r"
+}
+
# rpm based distros
if [ -d /etc/sysconfig ]; then
[ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
[ -f /etc/sysconfig/scsi_reserve ] && . /etc/sysconfig/scsi_reserve
[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/scsi_reserve"
- success=success
- failure=failure
fi
# deb based distros
@@ -30,20 +41,8 @@ if [ -d /etc/default ]; then
[ -f /etc/default/cluster ] && . /etc/default/cluster
[ -f /etc/default/scsi_reserve ] && . /etc/default/scsi_reserve
[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/scsi_reserve"
- success=local_success
- failure=local_failure
fi
-local_success()
-{
- echo -ne "[ OK ]\r"
-}
-
-local_failure()
-{
- echo -ne "[FAILED]\r"
-}
-
# check that cman is running
#
if ! cman_tool status > /dev/null 2>&1; then
@@ -166,14 +165,14 @@ case $1 in
# leave fence domain if any errors occured during registration
#
if [ $error -eq 0 ] ; then
- $success
+ success
else
logger -t scsi_reserve \
"[info] $count errors during registration"
logger -t scsi_reserve \
"[info] leaving the fence domain"
fence_tool leave
- $failure
+ failure
fi
touch $LOCK_FILE
@@ -232,11 +231,11 @@ case $1 in
# report success or failure
#
if [ $error -eq 0 ] ; then
- $success
+ success
else
logger -t scsi_reserve \
"[info] $count errors occured during unregistration"
- $failure
+ failure
fi
rm -f $LOCK_FILE
@@ -286,14 +285,14 @@ case $1 in
# leave fence domain if any errors occured during registration
#
if [ $error -eq 0 ] ; then
- $success
+ success
else
logger -t scsi_reserve \
"[info] $count errors during registration"
logger -t scsi_reserve \
"[info] leaving the fence domain"
fence_tool leave
- $failure
+ failure
fi
echo
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-01-09 12:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-09 12:53 fence-agents: master - fence_scsi: improve init script Fabio M. Di Nitto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).