Raspbian을 실행하는 라즈베리 파이에서 init.d를 사용하여 서비스를 시작하는 방법은 무엇입니까?

Raspbian을 실행하는 라즈베리 파이에서 init.d를 사용하여 서비스를 시작하는 방법은 무엇입니까?

라즈베리파이에 Raspbian이 설치되어 있습니다. 시작 시 스크립트를 자동으로 시작할 수 있는 몇 가지 가이드를 찾았습니다. 하지만 작동하지 않습니다.

update-rc.d(철자가 맞는지 확실하지 않음)를 실행하고 확인한 결과 /etc/rcx.d에 다양한 항목이 생성되었습니다.. 이러한 항목은 문자 K 또는 S로 시작됩니다.

"sudo service myscripthere start"(또는 중지/다시 시작)를 사용하여 스크립트를 수동으로 실행할 수 있습니다. "mybinary"는 /usr/local/bin에 있습니다.

무엇이 잘못되었을 수 있는지에 대한 아이디어가 있나요? 감사해요


스크립트의 내용입니다.

### BEGIN INIT INFO
# Provides:          myscript
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

case "$1" in
start)   echo -n "Start services"
   /usr/local/bin/mybinary -start
   ;;
stop)   echo -n "Stop services"
   /usr/local/bin/mybinary -stop
   ;;
restart)
   $0 stop
   $0 start
        ;;
*)   echo "Usage: $0 start|stop|restart"
        exit 1
        ;;
esac
exit 0

관련 정보