[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Linux-cluster] Script failed to run on RHCS, but it is successful on manually



Title: Script failed to run on RHCS,but it is successful on manually

HI,

tomcat_agent script failed to run when RHCS started. But I can run it successfully on manually. could you please check my script and tell me what problem?Below is cluster configuration and script:

[root db05 init.d]# cat /etc/cluster/cluster.conf

<?xml version="1.0"?>

<cluster config_version="4" name="NLS_Test">

        <fence_daemon post_fail_delay="0" post_join_delay="3"/>

        <clusternodes>

                <clusternode name="db05" nodeid="1" votes="1">

                        <fence>

                                <method name="1"/>

                        </fence>

                </clusternode>

                <clusternode name="db07" nodeid="2" votes="1">

                        <fence>

                                <method name="1"/>

                        </fence>

                </clusternode>

        </clusternodes>

        <cman expected_votes="1" two_node="1"/>

        <fencedevices>

                <fencedevice agent="fence_ipmilan" auth="none" ipaddr="10.69.128.25" login="test" name="ilo_db05" passwd="Administrator"/>

                <fencedevice agent="fence_ipmilan" auth="none" ipaddr="10.69.128.27" login="test" name="ilo_db07" passwd="Administrator"/>

        </fencedevices>

        <rm>

                <failoverdomains>

                        <failoverdomain name="ALLFOD" ordered="1" restricted="1">

                                <failoverdomainnode name="db05" priority="3"/>

                                <failoverdomainnode name="db07" priority="4"/>

                        </failoverdomain>

                        <failoverdomain name="ODDFOD" ordered="1" restricted="1">

                                <failoverdomainnode name="db05" priority="3"/>

                        </failoverdomain>

                </failoverdomains>

                <resources>

                        <script file="/etc/init.d/tomcat_agent" name="tomcat_agent"/>

                </resources>

                <service autostart="1" domain="allFOD" name="tomcat" recovery="restart">

                        <ip address="198.18.27.125/24" monitor_link="1"/>

                        <fs device="/dev/mapper/nls_testp2" force_fsck="1" force_unmount="0" fstype="ext3" mountpoint="/opt/nls/float/tomcat" name="tomcat" options="" self_fence="0"/>

                        <script ref="tomcat_agent"/>

                </service>

        </rm>

</cluster>

[root db05 init.d]# cat tomcat_agent

#!/bin/bash

# file: tomcat_agent

# desc: Tomcat service agent, invoked by RHCS

source /etc/init.d/core_agent

TOMCAT_DIR=`ls ${_tomcat_home} | grep tomcat`

TOMCAT_BIN_DIR="${_tomcat_home}/${TOMCAT_DIR}/bin"

RETVAL=1

TOMCAT_STOP="./shutdown.sh"

TOMCAT_START="./startup.sh"

status() {

echo "status test" >> /tmp/wxg.txt

    #TODO: to monitor the port or whatever else in drop1a

    ps aux | grep -v grep | grep ${TOMCAT_DIR} 2>&1 > /dev/null

    return $?

}


start() {

echo "start" >>/tmp/wxg.txt

    sudo -i -u nls sh -c "/opt/nls/float/tomcat/apache-tomcat-6.0.33/bin/startup.sh" 2>&1 > /dev/null

    sleep 3

    status

        return $?

}

stop() {

echo "stop" >>/tmp/wxg.txt

sudo -i -u nls sh -c "/opt/nls/float/tomcat/apache-tomcat-6.0.33/bin/shutdown.sh" 2>&1 > /dev/null

    sleep 3

    status

    if [ $? -ne 0 ]; then return 0; fi

}


case "$1" in

        start)

                start

                RETVAL=$?

        ;;

        stop)

                stop

                RETVAL=$?

        ;;

        status)

                status

                RETVAL=$?

        ;;

        restart)

                echo $1

                stop

                start

                RETVAL=$?

        ;;

        *)

               echo $1

                logger "Usage: $0 {start|stop|status|restart}"

                RETVAL=2

        ;;

esac

exit ${RETVAL}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]