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

응용 프로그램 시작

이 메소드는 프로세스 관리자 기능(pmfadm)을 사용하여 응용 프로그램을 시작합니다. pmfadm 명령을 사용하면 지정된 시간 프레임 동안 응용 프로그램을 재시작할 횟수를 설정할 수 있습니다. RTR 파일에는 응용 프로그램 재시작을 시도하는 횟수를 지정하는 Retry_count 등록 정보와 시도 기간을 지정하는 Retry_interval 등록 정보가 포함되어 있습니다.

Start 메소드는 scha_resource_get() 함수를 사용하여 Retry_countRetry_interval 값을 검색하고 이러한 값을 쉘 변수에 저장합니다. Start 메소드는 -n-t 옵션을 사용하여 이러한 값을 pmfadm으로 전달합니다.

# Get the value for retry count from the RTR file.
RETRY_CNT=`scha_resource_get -O Retry_count -R $RESOURCE_NAME \
-G $RESOURCEGROUP_NAME`
# Get the value for retry interval from the RTR file. This value is in seconds
# and must be converted to minutes for passing to pmfadm. Note that the 
# conversion rounds up; for example, 50 seconds rounds up to 1 minute.
((RETRY_INTRVAL=`scha_resource_get -O Retry_interval -R $RESOURCE_NAME \
-G $RESOURCEGROUP_NAME` / 60))

# Start the in.named daemon under the control of PMF. Let it crash and restart
# up to $RETRY_COUNT times in a period of $RETRY_INTERVAL; if it crashes
# more often than that, PMF will cease trying to restart it.
# If there is a process already registered under the tag
# <$PMF_TAG>, then PMF sends out an alert message that the
# process is already running.
pmfadm -c $PMF_TAAG -n $RETRY_CNT -t $RETRY_INTRVAL \
    /usr/sbin/in.named -c named.conf

# Log a message indicating that HA-DNS has been started.
if [ $? -eq 0 ]; then
   logger -p ${SYSLOG_FACILITY}.err \
         -t [$SYSLOG_TAG] \
         "${ARGV0} HA-DNS successfully started"
fi
exit 0