Raspberry Pi_Kor_06.3.2 terminal에서의 시스템 종료


Published Book on Amazon


All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


6.3.2     terminal에서의 시스템 종료

 

6.3.2.1       "shutdown" 명령

 

"shutdown"은 시스템 전체를 정상적인 방법으로 종료시키는 것이다

 

현재 실행중인 task가 있으면 모두 종료될 때까지 대기하고 있다가 모두 종료되었을 때 전체 운영시스템을 종료시킨다시스템이 종료되면 시스템에서 하고 있는 모든 작업들이 종료되고, 모든 네트워크 연결도 종료되며, logon한 사용자들에 대해서는 접속이 끊기게 된다.

 

이러한 중단의 효과는 특정 사용자에게만 미치는 것이 아니라 시스템을 사용하는 모든 사용자들에게 미치게 된다. 따라서 시스템에 여러 사용자들이 logon하여 작업 중이라고 하면, 해당 사용자들이 중단하지 않고 다른 작업을 하고자 하여도 모든 사용자들의 작업이 강제로 종료된다.   


 

[명령 형식]

shutdown    [option]  time  [warning-message]

 

[명령 개요]

    시스템을 정상적으로 종료하는 명령이다.

    user 권한    -- super user.

 

[상세 설명]

이 명령이 실행되면 모든 task는 중지되며, 모든 사용자는 logoff 되고, 모든 network 접속은 끊어지고, 최종적으로 시스템이 종료된다.

 

[주요 option]

-k

don't really shutdown, only warn.

-r

reboot after shutdown.

-h

halt after shutdown.

-f

do a 'fast' reboot (skip fsck).

-c

cancel a running shutdown.

-t secs

delay between warning and kill signal.

time

When to shutdown.

warning message

Message to send to all users.

 

[사용 Example] 

아래는 shutdown 명령을 실행한 것이다.

 

pi@raspberrypi ~ $ sudo shutdown now

Broadcast message from root@raspberrypi (pts/0) (Sun Jun 14 11:25:44 2015):

The system is going down to maintenance mode NOW!


 

6.3.2.2       "halt" 명령

 

"halt" 명령은 기본적으로 "shutdown"과 마찬가지로 시스템 전체를 종료시킨다. 차이점은 "shutdown"은 시스템을 정상적으로 종료하지만, "halt"시스템을 강제로 종료시키는 것이다.

 

시스템을 강제로 종료시킨다는 것은 현재 실행중인 task가 있을 때 모두 정상적으로 종료될 때까지 기다리지 않고, 현재 상태에서 모든 task를 강제로 종료시킨다는 것이다. 이 명령의 실행 결과는 위의 차이점을 제외하면 기본적으로 "shutdown"과 동일하다.

 

[명령 형식]

halt   [option]

 

[명령 개요]

    시스템을 강제로 종료시킨다.

    user 권한    -- super user.

 

[상세 설명]

    이 명령이 실행되면 모든 task는 강제로 중지되며, 모든 사용자는 logoff 되고, 모든 network 접속은 끊어지고, 최종적으로 시스템이 종료된다.

 

[주요 option]

-w

Don't actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).

-d

Don't write the wtmp record.

-f

Force halt or reboot, don't call shutdown(8).

-i

Shut down all network interfaces just before halt or reboot.

-h

Put all hard drives on the system in stand-by mode just before halt or power-off.

-p

When halting the system, switch off the power. This is the default when halt is called as poweroff.

 


 

[사용 Example] 

아래는 halt 명령을 실행한 것이다. .

 

pi@raspberrypi ~ $ sudo halt

Broadcast message from root@raspberrypi (pts/0) (Sun Jun 14 11:38:32 2015):

The system is going down for system halt NOW!

 

 


 

6.3.2.3       "poweroff" 명령 

 

이것은 운영시스템의 halt power off 기능이 결합된 것이다. halt 명령으로 전체 운영시스템을 종료시키고, 시스템 종료가 완료되면 시스템에 공급되는 전원을 차단하는 기능을 함께 실행한다.

 

Raspberry Pi 시스템에서는 hardware에서 외부적인 power switch를 제공하지 않으며, 또한 내부적으로도 power를 차단하는 장치가 없으므로 운영체제가 shutdown되더라도 power는 계속 공급되는 상태로 남아 있어서, 실제로 전원이 차단되는 기능은 작동하지 않는다. 이 명령의 실행 결과는 위의 차이점을 제외하면 기본적으로 halt와 동일하다.

 

[명령 형식]

poweroff   [option]

 

[명령 개요]     

    시스템을 강제로 종료시키고, 전원 공급을 차단한다.

    user 권한    -- super user.

 

[상세 설명]

이 명령이 실행되면 모든 task는 강제로 중지되며, 모든 사용자는 logoff 되고, 모든 network 접속은 끊어지고, 최종적으로 시스템이 종료된다.

 

[주요 option]

-w

Don't actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).

-d

Don't write the wtmp record.

-f

Force halt or reboot, don't call shutdown(8).

-i

Shut down all network interfaces just before halt or reboot.

-h

Put all hard drives on the system in stand-by mode just before halt or power-off.

-p

When halting the system, switch off the power. This is the default when halt is called as poweroff.

 


 

[사용 Example] 

아래는 poweroff 명령을 실행한 것이다.

 

pi@raspberrypi ~ $ sudo poweroff

Broadcast message from root@raspberrypi (pts/0) (Sun Jun 14 11:58:50 2015):

The system is going down for system halt NOW!

 


 

6.3.2.4       "reboot" 명령 

 

이것은 운영시스템의 halt boot 기능을 조합한 것으로, 현재의 운영시스템을 강제로 종료시키고, 다시 새롭게 운영시스템을 booting 하도록 지시하는 것이다

 

이 명령을 수행하면 기본적인 효과는 현재의 시스템이 종료된다는 의미에서는 위의 halt과 동일하다하지만 여기서는 시스템이 완전히 종료된 다음 다시 booting과정을 거쳐서 시스템이 새롭게 시작하는 특징이 있다. 이 명령의 실행 결과는 위의 차이점을 제외하면 기본적으로 halt와 동일하다.

 

[명령 형식]

reboot   [option]

 

[명령 개요]

    현재 실행중인 시스템을 종료시킨 다음, 시스템을 다시 booting 하도록 한다.

    user 권한    -- super user.

 

[상세 설명]

이 명령이 실행되면 모든 task는 강제로 중지되며, 모든 사용자는 logoff 되고, 모든 network 접속은 끊어지고, 최종적으로 시스템이 종료된 후 다시 booting한다.

 

[주요 option]

-w

Don't actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).

-d

Don't write the wtmp record.

-f

Force halt or reboot, don't call shutdown(8).

-i

Shut down all network interfaces just before halt or reboot.

-h

Put all hard drives on the system in stand-by mode just before halt or power-off.

-p

When halting the system, switch off the power. This is the default when halt is called as poweroff.

 

 

 

 

[사용 Example] 

아래는 reboot 명령을 실행한 것이다.

 

pi@raspberrypi ~ $ sudo reboot

Broadcast message from root@raspberrypi (pts/0) (Sun Jun 14 11:58:50 2015):

The system is going down for system halt NOW!

 

 

 


 

6.3.2.5       "logout" 명령 

 

logout은 전체 운영시스템은 그대로 두고, 시스템에 logon되어 있는 특정 사용자에 대한 처리를 종료하는 것이다.

 

따라서 지정된 사용자가 처리 중이던 작업을 모두 중지시키고, 지정된 작업들이 모두 중지되면 해당 사용자가 사용하고 있던 모든 시스템 자원을 해방시키고, 시스템과 사용자와의 연결을 끊는다.

 

이러한 중단의 효과는 logout을 한 특정 사용자에게만 미치고 다른 사용자들에게는 전혀 영향을 미치지 않는다따라서 다른 사용자들은 방해를 받지 않고 계속 작업을 진행할 수 있다.

 

[명령 형식]

logout

 

[명령 개요]

    user 권한    -- 일반 user.

 

[상세 설명]

    이렇게 특정 사용자가 logout 처리되면, 접속방식에 따라 시스템과의 접속 자체가 끊어질 수도 있고, 접속은 그대로 유지된 상태로 다른 사용자가 logon 할 수 있는 상태가 될 수도 있다.       

    local에서 Shell Terminal로 접속한 경우 logon 이전 화면으로 돌아 간다.   

    네트워크를 통하여 원격으로 Shell Terminal에 접속한 경우 접속 프로그램이 종료된다.  

    window terminal에서는 logout을 실행할 수 없다.

 

 


 

Leave a Reply