OpenWrt Forum Archive

Topic: Autostart on boot issue

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

Hallo,

i´m using an WNDR3700v4 with Barrier Breaker 14.07 and i get an issue.
I´m using this script

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

START=95

boot() {
    start
}

start() {
    screen -S dump1090 -d -m -L dump1090 --net >> /dev/null
}

stop() {
    screen -r dump1090 -X quit
}

The script is located in /etc/init.d/
I also Enable the script for autostart no problem about that.
BUT when i restart the Router is the issue that the script, or the started programm from the script, will stop working when the router has finished booting.
Everytime when the login screen from the router is comming up (after boot), the started prog. from the script stoped working.

What is the problem??
When i start the script manually after the boot sequence all works fine and the prog. will not stop.

Can somebody help me about that issue??

Thx
faxe2110

My guess is that dump1090 program exits itself.
May be caused by appearance or disappearance of network interface.
During boot network interfaces can be brought up and down and then up again.

Now i have changed the Firmware.
I´m running 15.05 / LuCi now
But same issue.

Softwarecenter - Install Dump1090 & luci-app-dump1090 - config. dump1090 via luci-app - reboot router - same issue

Starting up with dump1090 and when the router has finnish booting dump1090 stopped working.
Then i go into the luci-app, press "Save & Apply", and dump1090 starts working until the router will reboot.

@bolvan maybe you are right. But how can i fix that issue??

faxe2110 wrote:

@bolvan maybe you are right. But how can i fix that issue??

/etc/hotplug.d/iface/99-exec_on_updown

#!/bin/sh

local cmd

if [ "$ACTION" = ifup ]; then
 cmd=$(uci get network.$INTERFACE.exec_on_up)
 [ -n "$cmd" ] && $cmd
fi

if [ "$ACTION" = ifdown ]; then
 cmd=$(uci get network.$INTERFACE.exec_on_down)
 [ -n "$cmd" ] && $cmd
fi

/etc/config/network :

 config interface 'lan'
        option exec_on_up '/etc/my/ifup_lan'

/etc/my/ifup_lan :

#!/bin/sh

#put your code here

@bolvan

now i tryed your fix, but no!

Still same issue.
When i go via telnet and write

/etc/my/ifup_lan start

than the programm works but still not on boot.

Line " option exec_on_up '/etc/my/ifup_lan'" should be added to "config interface 'lan'" section.
ifup_lan is shell script and must be chmod +x. It does not take any parameters like 'start'.
Put there something like "echo ifup_lan executed >/tmp/test.txt"
and check if /tmp/test.txt was created. This way you'll be sure if its executed on interface start.
I meant to put there something like "/etc/init.d/your_service start"
and before that disable regular autostart with rc.d : /etc/init.d/your_service disable.

This way I avoid problems like not starting uhttpd or samba when configured to listen on specific ip address.
I put there
/etc/init.d/smbd start
/etc/init.d/uhttpd start
and disable regular autostart.

(Last edited by bolvan on 29 Jan 2016, 14:46)

Hmmm i know witch way you want to go, but openwrt 15.05 don´t think so. Dammmm

When i put

/etc/my/ifup_lan

#!/bin/sh /etc/rc.common
echo ifup_lan executed >/tmp/test.txt

than reboot the router, i become an txt file in /tmp with the name test.txt. So far so good.

BUT when i replace "echo ifup_lan executed >/tmp/test.txt" with

/etc/my/ifup_lan

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

/etc/init.d/dump start

then it doesen´t work.

/etc/init.d/dump

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

start() {
    screen -S dump1090 -d -m -L dump1090 --net >> /dev/null
}

stop() {
    screen -r dump1090 -X quit
}

When i use the /etc/init.d/dump start in terminal dump1090 starts!!!

Where do i have my f... problem?? Sorry

btw  /etc/init.d/dump is NOT enabled

(Last edited by faxe2110 on 29 Jan 2016, 16:28)

Why this line in ifup_lan ?

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

It must be

#!/bin/sh

(Last edited by bolvan on 29 Jan 2016, 18:59)

faxe2110 wrote:

Hallo,

i´m using an WNDR3700v4 with Barrier Breaker 14.07 and i get an issue.
I´m using this script

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

START=95

boot() {
    start
}

start() {
    screen -S dump1090 -d -m -L dump1090 --net >> /dev/null
}

stop() {
    screen -r dump1090 -X quit
}

The script is located in /etc/init.d/
I also Enable the script for autostart no problem about that.
BUT when i restart the Router is the issue that the script, or the started programm from the script, will stop working when the router has finished booting.
Everytime when the login screen from the router is comming up (after boot), the started prog. from the script stoped working.

What is the problem??
When i start the script manually after the boot sequence all works fine and the prog. will not stop.

Can somebody help me about that issue??

Thx
faxe2110

I don't know if this is your issue but you may need to supply the full path to screen. Example

screen -S dump1090 -d -m -L dump1090 --net >> /dev/null

becomes

/usr/sbin/screen -S dump1090 -d -m -L dump1090 --net >> /dev/null

You can find the full path to executable  by using the which command. Example

which screen
/usr/sbin/screen

I usually provide the full path for commands in init scripts since I am too lazy to figure out the $PATH differences between login and non-login shells (init scripts).

You to make my day!!! A combination fix my issue.

/usr/sbin/screen -S dump1090 -d -m -L dump1090 --net >> /dev/null

bolvan wrote:

Why this line in ifup_lan ?

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

It must be

#!/bin/sh

And last but not least, I put a sleep 120 in my script.

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


    START=95

sleep 120

start() {
        /usr/sbin/screen -S dump1090 -d -m -L dump1090 --net >> /dev/null
    }

    stop() {
        /usr/sbin/screen -r dump1090 -X quit
    }

Thanks for your help.

Greating from Sweden

(Last edited by faxe2110 on 29 Jan 2016, 23:17)

The discussion might have continued from here.