#!/bin/bash
# this shell script periodic check md200 for ccdb,For example, check whether there is a disk that is not in the raid group.
 
source /OSM/script/os_load_base.sh
source /OSM/script/ccdb_get_ld_device.sh
G_SYSTEM_DISK_DEVICE=

# --------------------------  main  ------------------------------------------ #
if [ $# -ne 5 ]; then
    OS_echo "usage:"$0" product_model engine_id linked_num node_id device_list"
    exit 1
fi

G_PRODUCT_MODEL=$1
G_ENGINE_ID=$2
G_LINKED_NUM=$3
G_NODE_ID=$4
G_SYS_DEVICE_LIST=$5

#获取系统盘信息
G_SYSTEM_DISK_DEVICE=$(CCDB_get_ready_nvRAM_disk $G_PRODUCT_MODEL $G_ENGINE_ID $G_LINKED_NUM $G_NODE_ID)
if [ "X$G_SYSTEM_DISK_DEVICE" == "X" ]; then
    OS_echo ""$0" get system disk is not ready."
    exit 0
fi

OS_echo ""$0" get system disk is ready now, device list is : ($G_SYSTEM_DISK_DEVICE)"

echo $G_SYSTEM_DISK_DEVICE | tr ' ' '\n' > $G_SYS_DEVICE_LIST

chmod 660 $G_SYS_DEVICE_LIST

exit 0
