FAQ
Sun Solaris에서 자동적으로 Reboot시 알티베이스를 Startup하는 방법 | |||||
분류 | 운영/관리 | 등록일 | 2013-07-09 | 조회수 | 2908 |
shine 2004-08-17 204 Sun Solaris에서 자동적으로 Reboot시 알티베이스를 Startup하는 방법 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 요약 ++++ Sun Solaris에서 booting시 자동으로 Altibase server를 startup하는 스크립트 작성 방법 Sun Solaris Startup Script ++++++++++++++++++++++++++ Solaris는 run level과 관계가 있는 rc스크립트를 제공합니다. 이 스크립트들 은 /sbin 디렉토리 안에 존재하며 /etc 디렉토리의 rc 스크립트와 심볼릭 링크되어 있습니다. /sbin/rc# 스크립트들은 그들과 일치하는 이름의 /etc/rc#.d 디렉토리 아래에 해당하 는 파일들이 존재하는데, /etc/rc#.d 디렉토리에는 run level을 위해 시스템 프로세 스를 start하고 stop하는 스크립트들을 포함하고 있습니다. 이 디렉토리 안에 존재하 는 파일들을 파일명이 K와 S로 시작하며, K* 스크립트는 프로세스 kill할 때 사용되 며, S* 스크립트는 프로세스를 start할 때 사용됩니다. 이들 파일은 alphanumeric 순 으로 수행됩니다. /etc/init.d 디렉토리 안에는 프로세스를 start 시키거나 또는 kill 시키는 실질적 인 run control 파일들이 존재하는데 이들은 etc/rc#.d 디렉토리와 하드링크 되어 있 습니다. STEP1 +++++ /etc/alti-conf.d/alti.conf file을 만듭니다. 이 file에서는 자동 구동시 필요한 변 수들을 정의하고 Setting합니다. 이 file의 내용은 아래와 같습니다. ################################################################# ALTIBASE_HOME=/home/altibase/altibase_home ; export ALTIBASE_HOME PATH=$ALTIBASE_HOME/bin:/usr/bin:/sbin ; export PATH ALTIBASE_OWNER=altibase START_ALTIBASE=1 ################################################################# 만약 자동 구동을 하고 싶지 않다면 START_ALTIBASE의 값을 0으로 맞추면 됩니다. 그 리고 ALTIBASE_OWNER나 ALTIBASE_HOME이 변경되었을 경우에는 반드시 이 File에 있 는 값을 수정 해 주어야 합니다. STEP2 +++++ /etc/init.d/alti_start file을 만든다. 이 script에서는 알티베이스 구동 명령어를 이용해서 실제로 DBMS를 startup하는 script입 니다. ################################################################# #!/sbin/sh if [ -f /etc/alti-conf.d/alti.conf ] ; then . /etc/alti-conf.d/alti.conf fi dbadmin < startup quit EOF ################################################################# STEP3 +++++ /etc/init.d/alti_stop file을 만든다. 이 script에서는 알티베이스 구동 명령어를 이용해서 실제로 DBMS를 stop하는 script 입니 다. ################################################################# #!/sbin/sh if [ -f /etc/alti-conf.d/alti.conf ] ; then . /etc/alti-conf.d/alti.conf fi dbadmin < shotdown normal quit EOF ################################################################# STEP4 +++++ /etc/init.d/altibase file을 만든다. 이 file은 실제로 나중에 startup script나 stop script가 symbolic link를 만들 file이다. 이 file의 내용은 아래와 같다. ################################################################ #!/sbin/sh # # Copyright (c) 1997, 2001 by Sun Microsystems, Inc. # All rights reserved. # #ident "@(#)altibase 1.0 04/08/17" case $1 in 'start') # source the system configuration variables if [ -f /etc/alti-conf.d/alti.conf ] ; then . /etc/alti-conf.d/alti.conf else echo "ERROR: /etc/alti-conf.d/alti.conf defaults file MISSING" fi # Check to see if this script is allowed to run... if [ "$START_ALTIBASE" != 1 ]; then exit 2 else # Execute the commands to start your subsystem su - $ALTIBASE_OWNER -c "/etc/init.d/alti_start" fi ;; 'stop') # source the system configuration variables if [ -f /etc/alti-conf.d/alti.conf ] ; then . /etc/alti-conf.d/alti.conf else echo "ERROR: /etc/alti-conf.d/alti.conf defaults file MISSING" fi # Check to see if this script is allowed to run... if [ "$START_ALTIBASE" != 1 ]; then exit 2 else su - $ALTIBASE_OWNER -c "/etc/init.d/alti_stop" # Execute the commands to stop your subsystem fi ;; *) echo "usage: $0 {start|stop}" exit 1 ;; esac exit 0 ################################################################# STEP5 +++++ /etc/rc3.d Directory에서 Startup Script와 Shutdown Script의 Hard Link를 만든 다. #cd /etc/rc3.d # ln /etc/init.d/altibase S955altibase STEP6 +++++ 각각의 Script가 정상적으로 수행될 수 있도록 수행 권한을 Setting한다. #cd /etc/rc3.d # chmod 755 S955altibase #cd /etc/init.d # chmod 755 *alti* STEP7 +++++ 정상적으로 동작하는 지 Test를 해본다. 이 때 Test는 root계정에서 수행해 보아야 한다. # /etc/init.d/altibase |