본문 바로가기

맥(솔라리스)

[솔라리스] Solaris 10에서 서비스 제어하기 (SMF / svccfg)

반응형

Solaris 10에서 서비스 제어하기 (SMF / svccfg)

Solaris 10부터는 기존 /etc/rc*.d 기반 부팅 방식 대신 SMF(Service Management Facility) 를 통해 서비스를 관리합니다.

Linux의 systemd 와 유사한 개념이며 서비스 등록·의존성 관리·자동 복구·상태 모니터링 기능을 제공합니다.

1. SMF 주요 명령어 구성

svcs : 서비스 상태 조회

svcadm : 서비스 시작/중지/재시작

svccfg : 서비스 설정 조회 및 수정

svcprop : 속성(Property) 조회

svcs -xv : 장애 서비스 상세 확인

2. 서비스 목록 조회

프롬프트 진입

svccfg

전체 서비스 목록 확인

svc:> list
application/print/rfc1179
application/font/stfsloader
network/rpc/smserver
network/dns/server
network/rpc/ocfserv
application/print/server

3. 특정 서비스 선택

DNS(named) 서비스를 선택합니다.

svc:> select network/dns/server

프롬프트 변경

svc:/network/dns/server>

서비스 속성(Property) 조회

svc:/network/dns/server> listprop
filesystem_minimal             dependency
filesystem_minimal/entities    fmri     svc:/system/filesystem/minimal
filesystem_minimal/grouping    astring  require_all
filesystem_minimal/restart_on  astring  none
filesystem_minimal/type        astring  service
loopback                       dependency
loopback/entities              fmri     svc:/network/loopback
loopback/grouping              astring  require_any
loopback/restart_on            astring  error
loopback/type                  astring  service
network                        dependency
network/entities               fmri     svc:/milestone/network
network/grouping               astring  optional_all
network/restart_on             astring  error
network/type                   astring  service
general                        framework
general/entity_stability       astring  Unstable
stop                           method
stop/exec                      astring  :kill
stop/timeout_seconds           count    60
stop/type                      astring  method
tm_common_name                 template
tm_man_named                   template
tm_man_named/manpath           astring  /usr/man
tm_man_named/section           astring  1M
tm_man_named/title             astring  named
svc:/network/dns/server> editprop
select svc:/network/dns/server

# Property group "filesystem_minimal"
# delprop filesystem_minimal
# addpg filesystem_minimal dependency
# setprop filesystem_minimal/entities = fmri: (svc:/system/filesystem/minimal)
# setprop filesystem_minimal/grouping = astring: (require_all)
# setprop filesystem_minimal/restart_on = astring: (none)
# setprop filesystem_minimal/type = astring: (service)

# Property group "loopback"
# delprop loopback
# addpg loopback dependency
# setprop loopback/entities = fmri: (svc:/network/loopback)
# setprop loopback/grouping = astring: (require_any)
# setprop loopback/restart_on = astring: (error)
# setprop loopback/type = astring: (service)

# Property group "network"
# delprop network
# addpg network dependency
# setprop network/entities = fmri: (svc:/milestone/network)
# setprop network/grouping = astring: (optional_all)
# setprop network/restart_on = astring: (error)
# setprop network/type = astring: (service)

# Property group "general"
# delprop general
# addpg general framework
# setprop general/entity_stability = astring: (Unstable)

# Property group "stop"
# delprop stop
# addpg stop method
# setprop stop/exec = astring: (:kill)
# setprop stop/timeout_seconds = count: (60)
# setprop stop/type = astring: (method)

# Property group "tm_common_name"
# delprop tm_common_name
# addpg tm_common_name template

# Property group "tm_man_named"
# delprop tm_man_named
# addpg tm_man_named template
# setprop tm_man_named/manpath = astring: (/usr/man)
# setprop tm_man_named/section = astring: (1M)
# setprop tm_man_named/title = astring: (named)
728x90

4. 인스턴스(Default) 선택

Solaris 서비스는 Service → Instance 구조입니다.

 

기본 인스턴스 선택

svc:/network/dns/server> select default

 

svc:/network/dns/server:default>

인스턴스 상세 설정 조회

svc:/network/dns/server:default> listprop

 

config_data                   dependency
config_data/entities          fmri     file://localhost/etc/named.conf
config_data/grouping          astring  require_all
config_data/restart_on        astring  none
config_data/type              astring  path
general                       framework
general/action_authorization  astring  solaris.smf.manage.bind
general/value_authorization   astring  solaris.smf.manage.bind
general/enabled               boolean  false
start                         method
start/exec                    astring  /usr/sbin/named
start/group                   astring  root
start/limit_privileges        astring  :default
start/privileges              astring  basic,!proc_session,!proc_info,!file_link_any,net_privaddr,file_dac_read,file_dac_search,sys_resource
start/project                 astring  :default
start/resource_pool           astring  :default
start/supp_groups             astring  :default
start/timeout_seconds         count    60
start/type                    astring  method
start/use_profile             boolean  false
start/user                    astring  root
start/working_directory       astring  :default
restarter                     framework NONPERSISTENT
restarter/auxiliary_state     astring  none
restarter/next_state          astring  none
restarter/state               astring  disabled
restarter/state_timestamp     time     1314504928.813081000

주요 설정

  • 서비스 실행 파일 : start/exec = /usr/sbin/named
  • BIND 설정 파일 : config_data/entities = file://localhost/etc/named.conf
  • 자동 시작 여부 : general/enabled = false
  • 현재 상태 : restarter/state = disabled

5. 서비스 활성화 / 시작

DNS 서비스 활성화

svcadm enable network/dns/server
  • 즉시 시작 + 부팅 시 자동 시작 등록

상태 확인

svcs network/dns/server

6. 서비스 중지 / 비활성화

중지

svcadm disable network/dns/server

강제 중지

svcadm disable -t network/dns/server

7. 서비스 재시작

svcadm restart network/dns/server

설정 변경 후 자주 사용됩니다.

8. 서비스 장애 확인

svcs -xv network/dns/server

9. 속성 직접 수정 예시

자동 시작 활성화

svccfg -s network/dns/server setprop general/enabled=true
svcadm refresh network/dns/server
svcadm enable network/dns/server

10. 설정 백업 및 내보내기

현재 서비스 설정 XML 백업

svccfg export network/dns/server > dns-server.xml

복구

svccfg import dns-server.xml

11. 실무에서 자주 쓰는 명령어

전체 서비스 상태

svcs -a

장애 서비스만 조회

svcs -xv

서비스 경로 검색

svcs | grep dns

속성 빠르게 확인

svcprop -p start/exec network/dns/server

 

728x90
반응형