문제

Linux 배포 (Angstrom Linux)를 실행하는 임베디드 보드 (비글 보드)와 함께 일하고 있습니다. 주어진 버튼이 보드에 밀려 나면 운영 체제를 부드럽게 중단하고 싶습니다. 내가 계획하는 것은 다음과 같습니다.

  1. init에서 루트 사용자로서 "파워 오프"데몬을 시작
  2. "파워 오프"주어진 버튼을 누른지 확인하기 위해 마법 코드를 실행합니다.
  3. 버튼을 누르면 "전원 오프"호출 "Halt"

내 텍스트 편집자와 코드를 뛰어 넘기 전에 그렇게 할 표준 Linux 데몬이 있습니까?

도움이 되었습니까?

해결책

The init daemon (process ID 1) is set up to map the SIGWINCH signal to the kb ("keyboard request") action, which is free for you to define. init is what maps a ctrl-alt-del key press to a reboot; so it would make sense to have init handle your shutdown button too.

To implement this you just need to write a little kernel code to map your "shut down" button to send a SIGWINCH to PID 1, then set up the kb action to call shutdown -h in /etc/inittab.

다른 팁

I don't know the details of your board.. but take a look at the 'hal' daemon.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top