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

[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
Director of Information Technology
United Radio Incorporated, DBA BlueStar
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

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