shutdown 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-shutdown
핵심 정리
- 시스템을 안전하게 멈춥니다. 자주 쓰는 형태:
shutdown -Fr(바로 재시작),shutdown -F(바로 정지·전원 끄기),shutdown -r +5(5분 뒤 재시작, 사용자에게 알림). - 기본은 60초를 기다리며 모든 사용자에게 경고하고, 계정·오류 로그를 멈추고
killall,sync, 파일 시스템 마운트 해제,halt순으로 진행합니다. 완료 메시지 전에 전원을 끄면 파일 시스템이 손상될 수 있습니다. /etc/rc.shutdown이 있으면 맨 먼저 실행하며, 0이 아닌 값으로 끝나면 종료가 멈춥니다. 응용 프로그램 정지 스크립트를 여기에 넣습니다.-m은 유지 보수(단일 사용자) 모드로 내리며/에서 실행해야 합니다.-l은/etc/shutdown.log에 진행 기록을 남깁니다.- root만 실행할 수 있습니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (내용이 같고, 6.1 문서에 RBAC 안내가 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 5, 6.1 Volume 5 |
| 파일 | /usr/sbin/shutdown, /etc/rc.shutdown, /etc/shutdown.log |
| 관련 명령어 | reboot, halt, init, wall, sync, killall |
목적
시스템 운영을 끝냅니다.
영어 원문
Ends system operation.
구문
shutdown [ -d ] [ -F ] [ -h ] [ -i ] [ -k ] [ -l ] [ -m ] [ -p ] [ -r ] [ -t mmddHHMM [ yy ] ] [ -u ] [ -v ] [ +Time [ Message ] ]
설명
shutdown 명령은 운영 체제를 멈춥니다. root 권한이 있는 사용자만 실행할 수 있습니다. 기본 종료에서는 wall 명령으로 곧 종료한다는 메시지를 사용자들에게 알립니다. 종료 완료 메시지를 받기 전에는 종료가 끝난 것이 아닙니다. 완료 메시지가 나오기 전에 시스템을 다시 시작하거나 끄면 파일 시스템이 손상될 수 있습니다.
참고: shutdown을 실행한 tty가 다중 포트 어댑터로 연결되어 있으면 halt completed 메시지가 그 tty에 나오지 않습니다.
종료 시각이 다가오면 시스템의 모든 사용자 터미널에 경고 메시지를 보여 줍니다.
지정한 초(기본 60초)가 지나면 계정과 오류 로그 프로세스를 멈추고 오류 로그에 항목을 씁니다. 그다음 killall로 남은 프로세스를 끝내고, sync로 메모리에 있는 디스크 블록을 모두 디스크에 씁니다. 끝으로 파일 시스템의 마운트를 풀고 halt 명령을 부릅니다.
참고: shutdown을 실행하는 노드의 파일을 열어 두었지만 그 노드에 로그인하지 않은 사용자에게는 알리지 않습니다.
운영 체제를 완전히 멈추라고 하면 모든 프로세스를 멈추고 모든 파일 시스템의 마운트를 풀고 halt를 부릅니다.
시스템 관리자는 로컬 종료 절차를 /etc/rc.shutdown 셸 스크립트에 넣을 수 있습니다. 이 스크립트가 있으면 종료를 시작할 때 실행하며, 0이 아닌 반환 코드로 실패하면 종료가 멈춥니다.
주의: 유지 보수 모드로 내릴 때는 파일 시스템을 깨끗이 내릴 수 있도록 /(루트) 디렉터리에서 shutdown을 실행해야 합니다.
참고: 소프트웨어로 전원을 제어할 수 있는 모델에서는 기본으로 시스템 전원을 끕니다.
영어 원문
The shutdown command halts the operating system. Only a user with root user authority can run this command. During the default shutdown, users are notified (by a wallcommand) of the impending system shutdown with a message. However, shutdown is not complete until the user receives a shutdown completion message. Do not attempt to restart the system or turn off the system before the shutdown completion message is displayed; otherwise, file system damage can result.
Note: The halt completed message is not displayed on the tty from which shutdown is invoked if it is connected to the system through a multiport adapter.
As shutdown time approaches, warning messages are displayed on the terminals of all users on the system.
After the specified number of seconds (60 by default), the system stops the accounting and error logging processes and writes an entry to the error log. The shutdown command then runs the killall command to end any remaining processes and runs the sync command to flush all memory resident disk blocks. Finally, it unmounts the file systems and calls the halt command.
Note: Users who have files open on the node that is running the shutdown command, but who are not logged in to that node, are not notified about the shutdown.
If you request a complete halt to the operating system, the shutdown command stops all processes, unmounts all file systems, and calls the halt command.
The system administrator can place local customized shutdown procedures in a shell script named /etc/rc.shutdown. This script runs at the beginning of the shutdown if it exists. If the script runs but fails with a non-zero return code, the shutdown stops.
Attention: If you are bringing the system down to maintenance mode, you must run the shutdown command from the / (root) directory to ensure that it can cleanly unmount the file systems.
Note: By default, if issued on models having a power supply capable of software control, the shutdown command turns off the system.
플래그
| 플래그 | 설명 |
|---|---|
-d |
분산 모드에서 다중 사용자 모드로 내립니다. |
-F |
빠른 종료. 다른 사용자에게 보내는 메시지를 건너뛰고 가능한 한 빨리 내립니다. +Time [ Message ]는 무시합니다. |
-h |
운영 체제를 완전히 멈춥니다. -v와 같습니다. |
-i |
대화식 모드. 종료 과정을 안내하는 메시지를 보여 줍니다. |
-k |
시스템을 내리지 않고 종료 경고 메시지만 보냅니다. 메시지를 보내는 것 말고는 아무것도 하지 않습니다. 프로세스를 끝내지 않고, -l을 줘도 /etc/shutdown.log에 기록하지 않고, /etc/rc.shutdown도 실행하지 않습니다. |
-l |
내리는 파일 시스템, 데몬, 사용자 로그인, 라이선스 서비스, 네트워크 인터페이스 정보를 /etc/shutdown.log에 만들거나 덧붙입니다. 종료가 실패했을 때 진단과 디버깅에 씁니다. 기록할 디스크 공간이 충분한지 확인합니다. |
-m |
유지 보수(단일 사용자) 모드로 내립니다. |
-p |
전원을 끄지 않고 멈춥니다. 무정전 전원 장치(UPS)가 씁니다. 영구 정지가 아닌 플래그와 함께 쓰면 효과가 없으며, 다른 피연산자가 예약 전원 켜기와 재부팅을 요청하면 전원은 꺼집니다. 5.3 문서는 "AIX 4.2 이상에만 해당"이라고 덧붙였습니다. |
-r |
종료한 뒤 reboot 명령으로 다시 시작합니다. |
-t mmddHHMM [ yy ] |
바로 종료하고 지정한 날짜에 다시 시작합니다. mm은 월, dd는 일, HH는 시, MM은 분, yy는 연도입니다. -v나 -h와 함께 쓸 수 없습니다. 종료할 때 전원을 자동으로 끄고 나중에 재부팅할 수 있는 알람이 있는 전원 장치에서만 지원하며, 그런 기능이 없으면 멈추거나 종료 직후 바로 재부팅할 수 있습니다. |
-u |
진단 프로그램이 플래시 메모리를 갱신하고 재부팅할 때 씁니다. |
-v |
운영 체제를 완전히 멈춥니다. |
영어 원문
-d— Brings the system down from a distributed mode to a multiuser mode.-F— Does a fast shutdown, bypassing the messages to other users and bringing the system down as quickly as possible. The+Time [ Message ] options are ignored if the-Fflag is specified.-h— Halts the operating system completely; same as the-vflag.-i— Specifies interactive mode. Displays interactive messages to guide the user through the shutdown.-k— Allows the administrator to broadcast the shutdown warning messages without causing the system to shut down. When the-kflag is used, no other shutdown activity occurs except for sending messages. For example, no processes are killed, no activity is logged in /etc/shutdown.log if the-lflag is specified, and if an /etc/rc.shutdown script exists it does not run.-l— Creates/appends the /etc/shutdown.log file that contains information about the filesystems, daemons, user login, licensing services, network interfaces being brought down. The file may be used for diagnostic and debugging purposes in the event of shutdown failures. Note: Ensure that there is enough disk space for the shutdown command to log the entries while using this flag.-m— Brings the system down to maintenance (single user) mode.-p— Halts the system without a power down. This is used by uninterruptible power supply (UPS). Note: The-pflag will have no effect if used in combination with flags not requiring a permanent halt. Power will still be turned off if other operands request a delayed power-on and reboot-r— Restarts the system after being shutdown with the reboot command.-tmmddHHMM [ yy ] — Shuts down the system immediately and then restarts the system on the date specified by mmddHHMM [ yy ] where mm Specifies the month. dd Specifies the day. HH Specifies the hour. MM Specifies the minute. yy Specifies the year. The shutdown -t flag cannot be used with the-vor-hoption. Note: This option is only supported on systems that have a power supply which automatically turns power off at shutdown and an alarm to allow reboot at a later time. Systems without this capability may hang or may reboot immediately after shutdown.-u— This flag is used by diagnostics to update the flash-memory and reboot.-v— Halts the operating system completely.
매개변수
| 매개변수 | 설명 |
|---|---|
+Time |
시스템을 멈출 시각. 즉시 종료는 now입니다. 미래 시각은 +분 또는 시:분(24시간제) 형식으로, 앞의 것은 지정한 분 뒤에, 뒤의 것은 그 시각에 내립니다. Message를 주려면 Time도 줘야 합니다. |
| Message | 보낼 메시지. |
영어 원문
+Time — Specifies the time at which the shutdown command stops the system. An immediate shutdown is indicated by the wordnowdisplayed on the screen. A future time can be specified in one of two formats: +number or hour:minute. The first form brings the system down in the specified number of minutes and the second brings the system down at the time of day indicated (as a 24-hour clock). If the Message parameter is specified, the Time parameter must also be specified.- Message — Specifies the message
보안
(6.1) RBAC와 Trusted AIX 사용자: 이 명령은 특권 작업을 할 수 있으며 특권 사용자만 할 수 있습니다. 권한과 특권은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다.
영어 원문
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.
예제
| 명령 | 하는 일 |
|---|---|
shutdown |
시스템을 끔. 1분 기다린 뒤 사용자 프로세스와 init 프로세스를 멈춤 |
shutdown -m +2 |
사용자에게 시간을 더 주고, 2분 뒤 다중 사용자 모드에서 유지 보수 모드로 내림 |
자주 쓰는 형태:
shutdown -Fr # 즉시 재시작
shutdown -r +10 "점검으로 10분 뒤 재시작합니다"
shutdown -l -Fr # 진행 기록을 /etc/shutdown.log에
shutdown -k +5 "테스트 경고" # 경고만 보냄
영어 원문
- To turn off the machine, enter:
shutdown
This shuts down the system, waiting 1 minute before stopping the user processes and the init process.
- To give users more time to finish what they are doing and bring the system to maintenance mode, enter:
shutdown -m +2
This brings the system down from multiuser mode to maintenance mode after waiting 2 minutes.
파일
| 파일 | 설명 |
|---|---|
/usr/sbin/shutdown |
shutdown 명령 |
영어 원문
- /usr/sbin/shutdown — Contains the shutdown command.
Related reference:
- telinit or init Command
- sync Command
Related information:
- wall command
- halt command
- kill command
리눅스(GNU)와 다른 점
리눅스에서 부트 이미지는 dracut·mkinitramfs로 만드는 initramfs와 GRUB 설정(grub2-mkconfig, grub2-install)이고, 부팅 순서는 UEFI의 efibootmgr로 바꿉니다. 종료와 재시작은 shutdown -h now, shutdown -r now, systemctl poweroff, systemctl reboot입니다. 리눅스 shutdown도 -r(재시작), -h(정지), +분, 시:분, 메시지를 쓰고 -c로 예약을 취소합니다. AIX의 /etc/rc.shutdown에 해당하는 것은 systemd 유닛의 ExecStop입니다.