public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: "Fabio M. Di Nitto" <fabbione@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: cluster: STABLE3 - rgmanager: improve init script Date: Fri, 09 Jan 2009 12:57:00 -0000 [thread overview] Message-ID: <20090109125724.1424A1204EA@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=95b9d0a259843b36a0e82325fdb3cf3b53226642 Commit: 95b9d0a259843b36a0e82325fdb3cf3b53226642 Parent: cdfc608eaa4608d929919bab87747631ad629f86 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:56:49 2009 +0100 rgmanager: 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> --- rgmanager/init.d/rgmanager.in | 64 ++++++++++++++++++---------------------- 1 files changed, 29 insertions(+), 35 deletions(-) diff --git a/rgmanager/init.d/rgmanager.in b/rgmanager/init.d/rgmanager.in index 2a3a30c..697e66b 100644 --- a/rgmanager/init.d/rgmanager.in +++ b/rgmanager/init.d/rgmanager.in @@ -13,15 +13,34 @@ # Description: Starts and stops Red Hat Service (resource group) Manager ### END INIT INFO +success() +{ + echo -ne "[ OK ]\r" +} + +failure() +{ + echo -ne "[FAILED]\r" +} + +status() +{ + pid=$(pidof $1 2>/dev/null) + rtrn=$? + if [ $rtrn -ne 0 ]; then + echo "$1 is stopped" + else + echo "$1 (pid $pid) is running..." + fi + return $rtrn +} + # rpm based distros if [ -d /etc/sysconfig ]; then [ -f @INITDDIR@/functions ] && . @INITDDIR@/functions [ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster [ -f /etc/sysconfig/rgmanager ] && . /etc/sysconfig/rgmanager [ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/rgmanager" - success=success - failure=failure - status=status fi # deb based distros @@ -29,12 +48,9 @@ if [ -d /etc/default ]; then [ -f /etc/default/cluster ] && . /etc/default/cluster [ -f /etc/default/rgmanager ] && . /etc/default/rgmanager [ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/rgmanager" - success=local_success - failure=local_failure - status=local_status fi -PATH=/sbin:/bin:/usr/sbin:/usr/bin +PATH=/sbin:/bin:/usr/sbin:/usr/bin:@SBINDIR@ export PATH @@ -46,28 +62,6 @@ LOG_WARNING=4 LOG_NOTICE=5 LOG_INFO=6 -local_success() -{ - echo -ne "[ OK ]\r" -} - -local_failure() -{ - echo -ne "[FAILED]\r" -} - -local_status() -{ - pid=$(pidof $1 2>/dev/null) - rtrn=$? - if [ $rtrn -ne 0 ]; then - echo "$1 is stopped" - else - echo "$1 (pid $pid) is running..." - fi - return $rtrn -} - # # log_and_print <level> <message> # @@ -98,7 +92,7 @@ stop_cluster() while [ -n "`pidof $RGMGRD`" ]; do sleep 1 done - $success + success echo else echo "Services are stopped." @@ -128,9 +122,9 @@ case $1 in rtrn=$? if [ $rtrn = 0 ]; then touch $LOCK_FILE - $success + success else - $failure + failure fi echo @@ -158,9 +152,9 @@ case $1 in kill -HUP $(pidof $RGMGRD) 2>&1 rtrn=$? if [ $rtrn = 0 ]; then - $success + success else - $failure + failure fi echo @@ -168,7 +162,7 @@ case $1 in ;; status) - $status $RGMGRD + status $RGMGRD exit $? ;;
reply other threads:[~2009-01-09 12:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090109125724.1424A1204EA@lists.fedorahosted.org \ --to=fabbione@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).