[Linux-cluster] script to enable, disable, start, stop and query status of cluster services

Jeff Harr jharr at opsource.net
Fri Sep 30 22:12:03 UTC 2005


Hey, that is cool -thanks man :-)

 

________________________________

From: linux-cluster-bounces at redhat.com
[mailto:linux-cluster-bounces at redhat.com] On Behalf Of Sean Gray
Sent: Friday, September 30, 2005 4:45 PM
To: linux-cluster at redhat.com
Subject: [Linux-cluster] script to enable, disable, start,stop and query
status of cluster services

 

I found the below useful for my cluster testing, enjoy!

#!/bin/bash
# Name: cluster
# Authors: Sean Gray <me @ seangray.com, sgray @ bluestarinc.com>
# Copyright 2005 under the GPL
# Version 0.1
# Enable, disable, start, stop and query status of cluster services
# on RHEL4.
#
SERVICES="ccsd cman lock_gulmd fenced clvmd rgmanager gfs"
STARTORDER="ccsd cman lock_gulmd fenced clvmd gfs rgmanager"
STOPORDER="rgmanager gfs clvmd fenced lock_gulmd cman ccsd"
enableStuff (){
        for SERVICE in `echo $SERVICES`;
        do
                chkconfig --level 2345 $SERVICE on;
        done;
        for SERVICE in `echo $SERVICES`;
        do
                chkconfig --list $SERVICE;
        done;

}

disableStuff (){
        for SERVICE in `echo $SERVICES`;
        do
                chkconfig --level 2345 $SERVICE off;
        done;
        for SERVICE in `echo $SERVICES`;
        do
                chkconfig --list $SERVICE;
        done;
}

startStuff (){
        for SERVICE in `echo $STARTORDER`;
        do
                service $SERVICE start;
        done;
}

stopStuff (){
        for SERVICE in `echo $STOPORDER`;
        do
                service $SERVICE stop;
        done;
}

serviceStatus (){
        for SERVICE in `echo $SERVICES`;
        do

                echo -e "\033[36m $SERVICE \033[0m"
                service $SERVICE status;
                echo -e "\n"
        done;
}


case $1 in
        "enable" )
        enableStuff
        ;;

        "disable" )
        disableStuff
        ;;

        "start" )
        startStuff
        ;;

        "stop" )
        stopStuff
        ;;

        "status" )
        serviceStatus
        ;;

        * )
        echo -e "Usage: `basename $0`
{enable|disable|start|stop|status}"
        ;;
esac

Sean N. Gray <mailto:sgray at bluestarinc.com> 
Director of Information Technology
United Radio Incorporated, DBA BlueStar <http://www.bluestarinc.com> 
24 Spiral Drive
Florence, Kentucky 41042
office: 859.371.4423 x263
toll free: 800.371.4423 x263
fax: 859.371.4425
mobile: 513.616.3379 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-cluster/attachments/20050930/dff8c944/attachment.htm>


More information about the Linux-cluster mailing list