init.d에서 openWRT에 시작 서비스를 추가할 수 없습니다.

init.d에서 openWRT에 시작 서비스를 추가할 수 없습니다.

TP-Link TL-WA901N/ND v3에 openWrt를 설치했습니다. 공간이 부족해서 luci 패키지를 설치하지 않아서 cli를 통해 작업을 해야 했습니다.

내가 달성하고 싶은 것은 부팅 시 mon0 인터페이스를 생성하고 거기에서 tcpdump를 실행하는 것입니다. /etc/init.d에 파일을 만들고 이름을 monitor로 지정했습니다. 모니터링 파일에는 다음 내용이 포함되어 있습니다.

#!/bin/sh /etc/rc.common

#to start after /etc/init.d/network is started and stop after it stopped
START=99
STOP=1

start(){
    #tried with and without the following two lines
    include /lib/network
    scan_interfaces

    iw phy phy0 interface add mon0 type monitor
    ifconfig mon0 up
    echo "mon0 is up!"
}
stop(){
    ifconfig mon0 down
    iw mon0 del
    echo "mon0 is down!"
}

그런 다음 다음 명령을 실행합니다.

/etc/init.d/monitor enable

/etc/rc.d에는 S99monitor와 K1monitor가 보이는데, 재부팅을 하면 ifconfig 실행시 생성된 mon0 인터페이스가 보이지 않습니다.

수동으로 시작하면 작동합니다.

/etc/init.d/monitor start

또한 위 명령을 /etc/rc.local에 추가하려고 시도했지만 아무것도 변경되지 않았습니다.

내가 뭘 잘못했나요?

답변1

추가하는 것을 잊어버린 것 같아요

boot(){
start
}

부분

관련 정보