Sponsored Content
Operating Systems Linux Red Hat Custom HA agent - Red Hat Linux Cluster Post 302455973 by pshaikh on Thursday 23rd of September 2010 07:30:11 AM
Old 09-23-2010
Hi fpmurphy

I looked in /usr/share/cluster/script.sh (and I think that's the template for custom app failover?). Here is how it looks like

Code:
#
# Script to handle a non-OCF script (e.g. a normal init-script)
#

LC_ALL=C
LANG=C
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export LC_ALL LANG PATH

. $(dirname $0)/ocf-shellfuncs

meta_data()
{
    cat <<EOT
<?xml version="1.0"?>
<resource-agent version="rgmanager 2.0" name="script">
    <version>1.0</version>
.....
}

case $1 in
        meta-data)
                meta_data
                exit 0
                ;;
        *)
                ;;
esac

[ -n "${OCF_RESKEY_file}" ] || exit $OCF_ERR_ARGS      # Invalid Argument
[ -f "${OCF_RESKEY_file}" ] || exit $OCF_ERR_INSTALLED # Program not installed
[ -x "${OCF_RESKEY_file}" ] || exit $OCF_ERR_GENERIC   # Generic error

# Don't need to catch return codes; this one will work.
ocf_log info "Executing ${OCF_RESKEY_file} $1"
${OCF_RESKEY_file} $1

declare -i rv=$?
if [ $rv -ne 0 ]; then
        ocf_log err "script:$OCF_RESKEY_name: $1 of $OCF_RESKEY_file failed (returned $rv)"
        exit $OCF_ERR_GENERIC
fi

Using above template i have created 'dummy_service.sh' and added status, start, stop, verify-all, monitor options in it (looking at apache.sh) to start, stop, monitor, verify my application is running (actually i am just trying to start httpd and stop it for now before going to more complex custom app)

If you like I can attach that script too.

Thanks

---------- Post updated 23-09-10 at 12:57 AM ---------- Previous update was 22-09-10 at 11:25 PM ----------

Alright it seems like 'script.sh' is not template for custom failover script

It is actually a resource agent for 'script' resource, in this script resource we need to provide path for /etc/init.d/<my script>

However this is a bit limiting, there are some unknown caveats like how to find out a node from which service is failed over (name of node on which service was previously running) and accessing shared resources (e.g. floating IP addresses)

---------- Post updated at 06:30 AM ---------- Previous update was at 12:57 AM ----------

I was able to set up custom HA agent; looking at few more options,

Thanks

Last edited by pshaikh; 09-23-2010 at 01:32 AM..
 

8 More Discussions You Might Find Interesting

1. Red Hat

The Red Hat Cluster Manager Installation and

Linux RedHat Cluster Manager InstallationAdministrationGuide (0 Replies)
Discussion started by: merlin
0 Replies

2. Linux

Red Hat cluster

hi... I'm new to clustering concept, there was a issue in redhat clustering as "unable to load cluster.xml no such file or directory".. this issue restrict me from starting the cluster services and too execution of clustat command .. myself using vmware work station for the cluster setup with... (4 Replies)
Discussion started by: sriniv666
4 Replies

3. Red Hat

Free Cluster software with Red Hat Linux 5.0

Hi, I would like to know wheather any free cluster software is coming with Red Hat Ent Linux Medias? or needs to be purchased seperately. (3 Replies)
Discussion started by: manoj.solaris
3 Replies

4. UNIX for Dummies Questions & Answers

how to know if i use "Red Hat Enterprise Linux" or "Red Hat Desktop" ?

how to know if i use "Red Hat Enterprise Linux" or "Red Hat Desktop" ? (2 Replies)
Discussion started by: ahmedamer12
2 Replies

5. Red Hat

Red Hat Cluster Luci Authentication Failed

Hello everyone, I'm setting up a cluster with 2 nodes using Red Hat enterprise 6.2 x86_64, 1 luci and 1 ricci for education purpose. Ricci is installed and already running and luci is installed and running but at the time of add and create the cluster through the web gui it give me a error... (1 Reply)
Discussion started by: typeav
1 Replies

6. UNIX and Linux Applications

Configuration of Linux cluster managment on Red Hat 5.x server

Hi Experts, I have question regarding linux cluster managment on Red Hat 5.x server. When I try to install 'luci' or 'ricci' in one of our linux servers it is giving me below error:- yum install luci Loaded plugins: katello, product-id, rhnplugin, security, subscription-manager Updating... (0 Replies)
Discussion started by: Amey Joshi
0 Replies

7. Red Hat

Red Hat High Availability (HA) Cluster

How can we implement a service in HA, which in not available in HA. like sldap or customize application. Requirement Details. NODE1 service slapd is running.(Require) NODE2 service slapd is running.(Require) on both the node replication is happening. Now here requirement is need... (2 Replies)
Discussion started by: Priy
2 Replies

8. Fedora

Which is the better platform to learn UNIX/Linux (Kali Linux Vs. Red Hat or other)?

I just started a new semester and I started my UNIX class yesterday. I've already decided to use python along with my learning process but what I really want to use with it is Kali as my UNIX/Linux platform to learn off of since I already wanted to learn Cyber Sec. anyways. I just wanted to know if... (12 Replies)
Discussion started by: ApacheOmega
12 Replies
basename(1)							   User Commands						       basename(1)

NAME
basename, dirname - deliver portions of path names SYNOPSIS
/usr/bin/basename string [suffix] /usr/xpg4/bin/basename string [suffix] dirname string DESCRIPTION
The basename utility deletes any prefix ending in / and the suffix (if present in string) from string, and prints the result on the stan- dard output. It is normally used inside substitution marks (``) within shell procedures. /usr/bin The suffix is a pattern defined on the expr(1) manual page. /usr/xpg4/bin The suffix is a string with no special significance attached to any of the characters it contains. The dirname utility delivers all but the last level of the path name in string. EXAMPLES
Example 1: Setting environment variables The following example, invoked with the argument /home/sms/personal/mail sets the environment variable NAME to the file named mail and the environment variable MYMAILPATH to the string /home/sms/personal: example% NAME=`basename $HOME/personal/mail` example% MYMAILPATH=`dirname $HOME/personal/mail` Example 2: Compiling a file and moving the output This shell procedure, invoked with the argument /usr/src/bin/cat.c, compiles the named file and moves the output to cat in the current directory: example% cc $1 example% mv a.out `basename $1 .c` ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of basename and dirname: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: /usr/bin +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ /usr/xpg4/bin +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWxcu4 | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
expr(1), basename(3C), attributes(5), environ(5), standards(5) SunOS 5.10 18 Mar 1997 basename(1)
All times are GMT -4. The time now is 04:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy