stopsrc 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-stopsrc
핵심 정리
- SRC에 하위 시스템(데몬)이나 그룹, 하위 서버, 또는 모든 하위 시스템을 멈추라고 요청합니다.
stopsrc -s sshd(하나),stopsrc -g nfs(그룹),stopsrc -t ftp(하위 서버),stopsrc -a(모두).- 보통 멈춤은 하던 일을 마치고 자원을 푼 뒤 끝내고,
-f(강제)는 일이 끝나기를 기다리지 않고 바로 끝냅니다. -c(취소)는 SIGTERM을 보내고, 하위 시스템 객체 클래스에 정한 대기 시간이 지나도 안 끝나면 SIGKILL을 보냅니다.- 결과는
lssrc -s 이름으로 확인합니다(inoperative면 멈춘 것).
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1 문서에 RBAC 보안 안내가 더해짐. 플래그는 같음) |
| 원문 | IBM Commands Reference — 5.3 Volume 5, 6.1 Volume 5 |
| 파일 | /usr/bin/stopsrc, /etc/objrepos/SRCsubsys, /etc/objrepos/SRCsubsvr |
| 관련 명령어 | startsrc, lssrc, refresh, srcmstr |
목적
하위 시스템, 하위 시스템 그룹, 하위 서버를 멈춥니다.
영어 원문
Stops a subsystem, a group of subsystems, or a subserver.
구문
하위 시스템을 멈출 때:
stopsrc [ -h Host ] [ -f | -c ] { -a | -g Group | -p SubsystemPID | -s Subsystem }
하위 서버를 멈출 때:
stopsrc [ -h Host ] [ -f ] -t Type [ -p SubsystemPID ] [ -P SubserverPID | -o Object ]
설명
stopsrc 명령은 시스템 자원 제어기(SRC)에 하위 시스템, 하위 시스템 그룹, 또는 모든 하위 시스템을 멈추라고 요청합니다. 하위 서버를 멈추라는 요청은 하위 시스템 요청 패킷으로 SRC에 보내 하위 시스템에 전달하게 합니다.
-f(강제 멈춤)가 없으면 보통 멈춤으로 봅니다. 보통 멈춤은 하위 시스템이나 하위 서버가 지금 하는 처리를 모두 마치고, 응용 프로그램 활동이 모두 끝나면 자원을 푼 뒤 끝나도록 요청합니다. 하위 시스템은 새 작업 요청을 받지 않아야 합니다.
강제 멈춤은 하위 시스템이나 하위 서버가 응용 프로그램 활동이 끝나기를 기다리지 않고 자원을 모두 풀며 빨리 끝나도록 요청합니다.
취소(cancel)는 하위 시스템의 자원이 풀리고 유예 시간이 지난 뒤 하위 시스템을 멈춥니다. 유예 시간은 하위 시스템 객체 클래스에 정합니다. 취소는 하위 시스템을 멈출 때만 쓰며 늘 SIGTERM 신호로 보냅니다. 하위 시스템은 이 신호를 받아 정리 작업을 하고 끝나야 합니다. 객체 클래스에 정한 대기 시간 안에 끝나지 않으면 SIGKILL을 보내 확실히 멈춥니다.
하위 시스템이 소켓이나 메시지 큐로 통신하면 패킷을 만들어 보내고, 신호로 통신하면 하위 시스템 객체 클래스에 정한 신호를 보냅니다.
영어 원문
The stopsrc command sends a request to the System Resource Controller (SRC) to stop a subsystem, a group of subsystems, or all subsystems. The stopsrc command sends the System Resource Controller a subsystem request packet that is forwarded to the subsystem for a stop subserver request.
In the absence of the -f (stop force) flag, a normal stop action is assumed. A normal stop requests that a subsystem or subserver complete all current processing, release resources when all application activity has been completed, and then end. No new requests for work should be accepted by the subsystem.
A forced stop requests that a subsystem or subserver end quickly, releasing all resources, but not wait for application activity to complete.
A cancel action stops the subsystem after the subsystem's resources are released and after a grace period. This grace period is specified in the subsystem object class. The cancel stop is used only for subsystem stops and is always sent to the subsystem as the SIGTERM signal. The subsystem should catch this signal, perform subsystem clean up operations, and end. If the subsystem does not end within the wait time period, specified in the subsystem object class, the subsystem is sent a SIGKILL signal to ensure that the subsystem stops.
If the subsystem uses sockets or message queues for communication, a packet is constructed and sent to the subsystem. If the subsystem uses signals for communication, the subsystem is sent the appropriate signal from the subsystem object class.
플래그
| 플래그 | 설명 |
|---|---|
-a |
모든 하위 시스템을 멈춥니다. |
-c |
취소 멈춤 요청입니다. 하위 시스템에 SIGTERM을 보내고, 객체 클래스에 정한 대기 시간이 지나도 끝나지 않으면 SIGKILL을 보냅니다. |
-f |
강제 멈춤 요청입니다. |
-g Group |
멈출 하위 시스템 그룹. 하위 시스템 객체 클래스에 없는 그룹이면 실패합니다. |
-h Host |
이 동작을 요청할 원격 호스트. 로컬 사용자는 root로 실행해야 합니다. 원격 시스템은 원격 SRC 요청을 받도록 구성되어 있어야 합니다. 곧 srcmstr 데몬(/etc/inittab 참고)이 -r 플래그로 시작되어 있고, /etc/hosts.equiv나 .rhosts가 원격 요청을 허용해야 합니다. |
-o Object |
하위 서버 Object 값을 문자열로 하위 시스템에 넘깁니다. |
-p SubsystemPID |
멈출 하위 시스템의 특정 인스턴스, 또는 하위 서버 멈춤 요청을 보낼 하위 시스템 인스턴스. |
-P SubserverPID |
하위 서버 PID를 문자열로 하위 시스템에 넘깁니다. |
-s Subsystem |
멈출 하위 시스템. 실제 이름이나 동의어 이름을 씁니다. 지금 활성인 그 하위 시스템의 인스턴스를 모두 멈춥니다. 하위 시스템 객체 클래스에 없으면 실패합니다. |
-t Type |
하위 서버를 멈춥니다. 하위 서버 객체 클래스에 없는 Type이면 실패합니다. |
영어 원문
-a— Specifies that all subsystems are to be stopped.-c— Specifies that the stop request is a canceled stop request. For a cancel stop request, a SIGTERM signal is sent to the subsystem. After the wait time contained in the subsystem object class has passed, if the subsystem has not yet ended, the subsystem is sent a SIGKILL signal.-f— Specifies a forced stop request.-gGroup — Specifies that a group of subservers is to be stopped. The command is unsuccessful if the Group name is not contained in the subsystem object class.-hHost — Specifies the foreign Host machine on which this stop action is requested. The local user must be running as "root". The remote system must be configured to accept remote System Resource Controller requests. That is, the srcmstr daemon (see /etc/inittab) must be started with the-rflag and the /etc/hosts.equiv or .rhosts file must be configured to allow remote requests.-oObject — Specifies that a subserver Object value is to be passed to the subsystem as a character string.-pSubsystemPID — Specifies a particular instance of the subsystem to stop, or a particular instance of the subsystem to which the stop subserver request is to be passed.-PSubserverPID — Specifies that a subserver PID is to be passed to the subsystem as a character string.-sSubsystem — Specifies a subsystem to be stopped. The Subsystem parameter can be the actual subsystem name or the synonym name for the subsystem. The stopsrc command stops all currently active instances of the subsystem. The command is unsuccessful if the Subsystem name is not contained in the subsystem object class.-tType — Specifies that a subserver is to be stopped. The stopsrc command is unsuccessful if the Type specified is not contained in the subserver object class.
보안
RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1 문서에만 있음).
영어 원문
Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.
예제
| 명령 | 하는 일 |
|---|---|
stopsrc -h zork -s srctest -f |
원격 호스트 zork의 srctest 하위 시스템 인스턴스를 모두 강제로 멈춤 |
stopsrc -g tcpip -c |
tcpip 그룹의 모든 하위 시스템을 취소 멈춤 |
stopsrc -t tester -p 1234 |
PID 1234인 srctest 하위 시스템에 속한 tester 하위 서버를 멈춤 |
stopsrc -a |
로컬 머신의 활성 하위 시스템을 모두 멈춤 |
자주 쓰는 형태:
stopsrc -s sshd && startsrc -s sshd # sshd 다시 시작
stopsrc -g nfs # NFS 관련 데몬 모두 멈춤
stopsrc -s syslogd; lssrc -s syslogd # 멈췄는지 확인
참고: stopsrc -a는 sshd·inetd 같은 원격 접속 데몬도 멈추므로, 원격으로 접속한 상태에서는 쓰지 않습니다.
영어 원문
- To stop force a subsystem on a foreign host, enter:
stopsrc -h zork -s srctest -f
This forces a stop on all the instances of the srctest subsystem on the zork machine.
- To stop cancel a subsystem group, enter:
stopsrc -g tcpip -c
This activates a stop cancel on all the subsystems in the tcpip group.
- To stop a subserver, enter:
stopsrc -t tester -p 1234
This stops the tester subserver that belongs to the srctest subsystem with a subsystem PID of 1234.
- To stop all subsystems, enter:
stopsrc -a
This stops all the active subsystems on the local machine.
파일
| 파일 | 설명 |
|---|---|
/etc/objrepos/SRCsubsys |
SRC 하위 시스템 구성 객체 클래스 |
/etc/objrepos/SRCsubsvr |
SRC 하위 서버 구성 객체 클래스 |
/etc/services |
인터넷 서비스가 쓰는 소켓과 프로토콜 정의 |
/dev/SRC |
AF_UNIX 소켓 파일 |
/dev/.SRC-unix |
임시 소켓 파일의 위치 |
영어 원문
- /etc/objrepos/SRCsubsys — Specifies the SRC Subsystem Configuration Object Class.
- /etc/objrepos/SRCsubsvr — Specifies the SRC Subserver Configuration Object Class.
- /etc/services — Defines the sockets and protocols used for Internet services.
- /dev/SRC — Specifies the
AF_UNIXsocket file. - /dev/.SRC-unix — Specifies the location for temporary socket files.
Related reference:
- startsrc Command
Related information:
- refresh command
- System resource controller
- RBAC in AIX Version 7.1 Security
- Trusted AIX®
리눅스(GNU)와 다른 점
리눅스에서 SRC에 해당하는 것은 systemd입니다. lssrc -a는 systemctl list-units --type=service, lssrc -s 이름은 systemctl status 이름, startsrc -s·stopsrc -s는 systemctl start·stop, refresh -s는 systemctl reload에 가깝습니다. 하위 시스템 그룹(-g tcpip)은 systemd의 target이나 여러 단위를 한 번에 지정하는 것으로 대신합니다.