You are here

Veritas Cluster Resource Type Application create


Resource “my_zeit” vom Resource Type Application create

ACHTUNG:
Die rc.2 Datei soll man “my_zeit” nennen und nicht “my_xclock”, da im Script die Befehl „pgrep xclock“ einen Falschen wert liefert.

# more /etc/init.d/my_zeit 

#!/bin/ksh
DISPLAY=130.26.33.128:0.0
export DISPLAY
Kill()
{
        pids=`pgrep -u 0 xclock`
        [ -n "$pids" ] && kill -9 $pids
}
case $1 in
        start) 
                if [ -f /usr/openwin/bin/xclock ]; then
                echo 'my_xclock wird gestartet.'
                /usr/openwin/bin/xclock  2>&1 &
                fi
                exit 0;
                ;;
        stop)  
                 /usr/bin/pkill -x -u 0 xclock
                Kill
                exit 0;
                ;;
        clean)  Kill
                ;;
        check)  
                pids=`pgrep xclock`
                [ -n "$pids" ] && exit 110;
                exit 100
                ;;
esac

1.) Ist zustand vom Cluster

root@DEFX0WF0 # hastatus
attempting to connect....connected

group           resource             system          message            
--------------- -------------------- --------------- --------------------
                                     DEFX0WF0        RUNNING            
                                     DEFX0WF1        RUNNING            
dataSG                               DEFX0WF0        ONLINE             
dataSG                               DEFX0WF1        OFFLINE            
-------------------------------------------------------------------------
                dataDGres            DEFX0WF0        ONLINE             
                dataDGres            DEFX0WF1        OFFLINE            
                IPres                DEFX0WF0        ONLINE             
                IPres                DEFX0WF1        OFFLINE            
                Mountres             DEFX0WF0        ONLINE             
-------------------------------------------------------------------------
                Mountres             DEFX0WF1        OFFLINE            
                NICres               DEFX0WF0        ONLINE             
                NICres               DEFX0WF1        ONLINE             
                Volres               DEFX0WF0        ONLINE             
                Volres               DEFX0WF1        OFFLINE

 

2. Resource erstelle

# haconf -makerw

# hares -add Appres Application dataSG
VCS:10245:Resource added
NameRule and Enabled attributes must be set before agent monitors
# hares -modify Appres StartProgram "/etc/init.d/my_zeit start"
# hares -modify Appres StopProgram "/etc/init.d/my_zeit stop"
# hares -modify Appres MonitorProgram  "/etc/init.d/my_zeit check"
# hares -modify Appres Critical 0
# hares -modify Appres Enabled 1
# haconf -dump -makero
#
hares -online Appres -sys DEFX0WF0

 

3. Link zur anderen Resoure herstellen

# haconf -makerw
# hares -link Mountres Appres       
#
haconf -dump -makero

 

4. Überprüfen von Abhängigkeiten

# hares -dep
#Group       Parent     Child
dataSG       IPres      NICres
dataSG       Mountres   Appres
dataSG       Mountres   Volres
dataSG       Volres     dataDGres
dataSG       dataDGres  IPres