Sun Management Center 4.0 설치 및 구성 설명서

ProcedureJumpStart 종료 스크립트 만들기

  1. JumpStart 프로필 디렉토리를 만든 시스템에 루트로 로그인합니다.

  2. JumpStart 설치 서버 및 프로필 디렉토리 만들기단계 2에서 만든 JumpStart 프로필 디렉토리로 이동합니다.

  3. JumpStart 종료 스크립트를 만듭니다.

    종료 스크립트에 대한 보안 고려 사항을 검토합니다. 그런 다음 보안 요구 사항에 따라 다음 샘플 종료 스크립트 중 하나를 지침으로 사용하여 JumpStart 프로필 디렉토리에 종료 스크립트를 만듭니다.

    첫 번째 예제에서는 비밀번호 시드와 커뮤니티 문자열이 하드코딩된 종료 스크립트를 보여 줍니다. 두 번째 예제에서는 비밀번호 시드와 커뮤니티 문자열을 입력하라는 메시지를 표시할 종료 스크립트를 보여 줍니다.

    sh 확장자를 사용하여 종료 스크립트를 저장합니다(예: base_agent_finish.sh).


예 6–5 샘플 종료 스크립트: 하드 코딩된 비밀번호 시드 및 커뮤니티 문자열

#!/bin/sh
#
# Program type      : Unix bourne shell script
# Description       : Standard finish script for installing and 
#                     setting up Sun Management Center core agent
#
#
#
ROOTDIR=${ROOTDIR:-/a}               # Root directory for new OS
MNTDIR=${ROOTDIR}/mnt
LOGDIR=${ROOTDIR}/var/tmp/sunmcfinish
SI_CONFIG_DIR=${SI_CONFIG_DIR:-/export/home/JumpStart/jumpstart}
INSTALL_RESP=${SI_CONFIG_DIR}/install.cfg
SETUP_RESP=${SI_CONFIG_DIR}/setup.cfg
#
#
# Begin Main Program
#
#
umask 022
mkdir -p $LOGDIR
#
# Copy the install and setup response file to target system
#
cp ${INSTALL_RESP} $LOGDIR
cp ${SETUP_RESP} $LOGDIR
#
# mount Sun Management Center image
#
mount -F nfs bootserver01:/export/home/JumpStart/AgentImage $MNTDIR
[ $? -ne 0 ] && exit 1
# 
# run es-inst with -a -R -T and -A options
# skip the next line for Flash Archive based deployment
# Do not use the -T option if you have specified the TARGET_DIRECTORY 
# tag in install.cfg
#
${MNTDIR}/disk1/sbin/es-inst -a -R /a -T /a/opt -A ${LOGDIR}/install.cfg
#
# Clean up any rc script with the same name if present
#
test -f ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart && \
rm -f ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart
rm -f /etc/init.d/SunMCJumpStart
#
# Place rc script in rc3.d and init.d to do setup
# Remember to access es-setup based on the target directory location
#
echo "Creating rc script..."
cat > ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart << EOF
#!/sbin/sh
#
rm /etc/rc3.d/S80SunMCJumpStart /etc/init.d/SunMCJumpStart
SECURITY_SEED=abc123
SNMPV1_STRING=private
export SECURITY_SEED SNMPV1_STRING
/opt/SUNWsymon/sbin/es-setup -e -A /var/tmp/sunmcfinish/setup.cfg
EOF
cp ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart \
     ${ROOTDIR}/etc/init.d/SunMCJumpStart
exit 0


예 6–6 샘플 종료 스크립트: 보안 비밀번호 시드 및 커뮤니티 문자열에 대한 프롬프트

#!/bin/sh
#
# Program type      : Unix bourne shell script
# Description       : Standard finish script for installing and 
#                     setting up Sun Management Center core agent
#
#
#
ROOTDIR=${ROOTDIR:-/a}               # Root directory for new OS
MNTDIR=${ROOTDIR}/mnt
LOGDIR=${ROOTDIR}/var/tmp/sunmcfinish
SI_CONFIG_DIR=${SI_CONFIG_DIR:-/export/home/JumpStart/jumpstart}
INSTALL_RESP=${SI_CONFIG_DIR}/install.cfg
SETUP_RESP=${SI_CONFIG_DIR}/setup.cfg
#
#
# Begin Main Program
#
#
umask 022
mkdir -p $LOGDIR
#
# Copy the install and setup response file to target system
#
cp ${INSTALL_RESP} $LOGDIR
cp ${SETUP_RESP} $LOGDIR
#
# mount Sun Management Center image
#
mount -F nfs bootserver01:/export/home/JumpStart/AgentImage $MNTDIR
[ $? -ne 0 ] && exit 1
#
# Read secure inputs from user who invoked boot net - install
#
echo "Enter Security seed:"
read SECURITY_SEED
echo "Enter SNMP string:"
read SNMPV1_STRING
#
# run es-inst with -a -R -T and -A options
# skip the next line for Flash Archive based deployment
# Do not use the -T option if you have specified the TARGET_DIRECTORY 
# tag in install.cfg
#
${MNTDIR}/disk1/sbin/es-inst -a -R /a -T /a/opt -A ${LOGDIR}/install.cfg
#
# create a temporary es-setup script to use the secure information 
# read earlier
# Remember to access es-setup based on the target directory location 
#
FILE2=/a/opt/SUNWsymon/sbin/es-setup
FILE=/a/opt/SUNWsymon/sbin/es-setup.jumpstart
mv $FILE2 $FILE
count=`wc -l $FILE`
count=`echo $count | cut -d' ' -f1`
ncount=$count
count_enter=`expr $ncount - 3`
while [ $ncount -gt 0 ] ; do
   k=`tail -$ncount $FILE | head -1`
   if [ $ncount -eq $count_enter ]
   then
       echo $k >> $FILE2
       echo "SECURITY_SEED=$SECURITY_SEED" >> $FILE2
       echo "SNMPV1_STRING=$SNMPV1_STRING" >> $FILE2
   else
       echo $k >> $FILE2
   fi
   ncount=`expr $ncount - 1`
done
chmod +x $FILE2
#
# Clean up any rc script with the same name if present
#
test -f ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart && \
rm  -f ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart \
rm -f /etc/init.d/SunMCJumpStart
#
# Place rc script in rc3.d and init.d to do setup and cleanup 
# Remember to access es-setup based on the target directory location
# 
echo "Creating rc script..."
cat > ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart << EOF
#!/sbin/sh
#
rm /etc/rc3.d/S80SunMCJumpStart /etc/init.d/SunMCJumpStart
/opt/SUNWsymon/sbin/es-setup -e -A /var/tmp/sunmcfinish/setup.cfg
mv /opt/SUNWsymon/sbin/es-setup.jumpstart /opt/SUNWsymon/sbin/es-setup
EOF
cp ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart \
   ${ROOTDIR}/etc/init.d/SunMCJumpStart
exit 0