Sample Header Ad - 728x90

Cannot add startup service to openWRT from init.d

3 votes
1 answer
6443 views
I have openWrt installed on a TP-Link TL-WA901N/ND v3. I don't have luci package installed because I don't have enough space, so I can only do thing via cli. What I'm trying to achieve is to create a mon0 interface at startup and run tcpdump on it. I've created a file in /etc/init.d and named it monitor. The monitor file contains the following #!/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!" } then I run the following /etc/init.d/monitor enable and in /etc/rc.d I can see S99monitor and K1monitor but when I reboot, I can't see the mon0 interface created when I do ifconfig. This works if I manually start it with /etc/init.d/monitor start I've also tried adding the command above to /etc/rc.local but nothing changed. What am I doing wrong?
Asked by saccu (91 rep)
Nov 4, 2014, 11:55 AM
Last activity: May 8, 2025, 11:04 AM