OpenWrt Forum Archive

Topic: Running script when boot

The content of this topic has been archived on 2 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm running this code and is working great, but whenever I enable it for running when booting, my router won't boot.

When I do

script start

is working, when I'm doing

script boot

is working too. But whenever I do

script enable

to make it run when boot, I restart my router and my router never starts, it freezes and I need to enter failsafe mode to unbrick it.

Am I doing anything wrong? Are START and STOP variables okay?

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

START=10
STOP=15

boot() {
    airmon-ng start wlan0
    sleep 1
    start
}

start() {
        rssi mon0 &
}

stop() {
    killall -9 rssi
    exit 1
}

Check if there is the proper symlink for "script" in /etc/rc.d (like S10script and K15script). I figure that for some reason the enable command sometimes doesn't put them there correctly.

cabada wrote:

I'm running this code and is working great, but whenever I enable it for running when booting, my router won't boot.

When I do

script start

is working, when I'm doing

script boot

is working too. But whenever I do

script enable

to make it run when boot, I restart my router and my router never starts, it freezes and I need to enter failsafe mode to unbrick it.

Am I doing anything wrong? Are START and STOP variables okay?

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

START=10
STOP=15

boot() {
    airmon-ng start wlan0
    sleep 1
    start
}

start() {
        rssi mon0 &
}

stop() {
    killall -9 rssi
    exit 1
}

you are attempting to run this script way too early in the boot process... try adjusting your start and stop values to something in the range of 90-99

see here for more info -->https://wiki.openwrt.org/doc/techref/process.boot

The discussion might have continued from here.