Solaris OS용 Sun Cluster 데이터 서비스 개발 안내서

구성 확인

DNS를 실행하려면 구성 디렉토리의 named.conf 파일에 있는 정보가 필요합니다. 따라서 Start 메소드는 DNS를 시작하기 전에 디렉토리와 파일을 액세스할 수 있는지 확인하기 위해 몇 가지 온전성 검사를 수행합니다.

Confdir 확장 등록 정보는 구성 디렉토리의 경로를 제공합니다. 이 등록 정보 자체는 RTR 파일에 정의되어 있습니다. 그러나 데이터 서비스를 구성할 때 클러스터 관리자가 실제 위치를 지정합니다.

샘플 데이터 서비스에서 Start 메소드는 scha_resource_get() 함수를 사용하여 구성 디렉토리의 위치를 검색합니다.


주 –

Confdir이 확장 등록 정보이므로 scha_resource_get()은 유형과 값을 모두 반환합니다. awk 명령은 값만 검색하여 쉘 변수인 CONFIG_DIR에 저장합니다.


# find the value of Confdir set by the cluster administrator at the time of
# adding the resource.
config_info=`scha_resource_get -O Extension -R $RESOURCE_NAME \
-G $RESOURCEGROUP_NAME Confdir`

# scha_resource_get returns the "type" as well as the "value" for the
# extension properties. Get only the value of the extension property 
CONFIG_DIR=`echo $config_info | awk '{print $2}'`

Start 메소드는 CONFIG_DIR 값을 사용하여 디렉토리에 액세스할 수 있는지 확인합니다. 액세스할 수 없는 경우 Start는 오류 메시지를 기록하고 오류 상태로 종료합니다. Start 종료 상태를 참조하십시오.

# Check if $CONFIG_DIR is accessible.
if [ ! -d $CONFIG_DIR ]; then
   logger -p ${SYSLOG_FACILITY}.err \
         -t [$SYSLOG_TAG] \
         "${ARGV0} Directory $CONFIG_DIR is missing or not mounted"
   exit 1
fi

응용 프로그램 데몬을 시작하기 전에 이 메소드는 named.conf 파일이 존재하는지 확인하기 위해 최종 검사를 수행합니다. 파일이 없는 경우 Start는 오류 메시지를 기록하고 오류 상태로 종료합니다.

# Change to the $CONFIG_DIR directory in case there are relative
# pathnames in the data files.
cd $CONFIG_DIR

# Check that the named.conf file is present in the $CONFIG_DIR directory
if [ ! -s named.conf ]; then
   logger -p ${SYSLOG_FACILITY}.err \
         -t [$SYSLOG_TAG] \
         "${ARGV0} File $CONFIG_DIR/named.conf is missing or empty"
   exit 1
fi