Forum Discussion

Jose_Luis_B's avatar
10 years ago

VCS - Resource to mount CIFS shares

Hi, I want to manage a CIFS mount within a Service Group and cannot find the appropriate resource. I just one to mount a CIFS share in my VCS cluster, acting as a client. Can anyone let me k...
  • mikebounds's avatar
    10 years ago

    You can use application agent - so for example create a file something like /opt/VRTSvcs/bin/cifs.sh containing:

    MOUNT_PATH=$2
    SRC_PATH=$3
    
    MOUNT=/bin/mount
    UMOUNT=/bin/umount
    GREP=/bin/grep
    
    if [ $# -eq 4 ]
    then
            MOUNT_OPTS="-o $4"
    fi
    
    case "$1" in
    start)
        $MOUNT -t cifs $MOUNT_OPTS $SRC_PATH $MOUNT_PATH
        ;;
    stop)
        $UMOUNT $MOUNT_PATH
        ;;
    monitor)
        $MOUNT | $GREP "^$SRC_PATH on $MOUNT_PATH type cifs" > /dev/null
        if [ $? -eq 0 ]
        then
            exit 110
        else
            exit 100
        fi ;;
    *)
        echo "Usage: $0 {start|stop|monitor} mount_path src_path"
        exit 1
        ;;
    esac

     

    Then create Application resource like:

    Application cifs_test (
      StartProgram  = "/opt/VRTSvcs/bin/cifs.sh start /test //win-svr/test username=mike,password=123"
      StopProgram  = "/opt/VRTSvcs/bin/cifs.sh stop /test"
      MonitorProgram = "/opt/VRTSvcs/bin/cifs.sh monitor /test //win-svr/test "
    )

     

    Mike