Help to make autostart for binare service or run init.d script

Hello i have an VERY frustrating issues with this trivial things.
Ax1800 Firmware Version4.2.0
I need to run automatic startup two binary package, qbittorrent and Torserver.
So i go to owrt manual about /init.d/ scripts Owrt site and make my own script and put it in to /init.d/ dir and in console enter: /overlay/upper/etc/init.d/torrserver enable
and chmod +x for scripts to
from console i manually run script by

 /overlay/upper/etc/init.d/torrserver start
/overlay/upper/etc/init.d/qbittorrent start

And it works well, no problem, service is start and work.
But when i reboot router, its begin a problem, only qbittorren startup, torserver don’t startup. And in some case when i try edit script by add :

#start torrserver
    /overlay/sbin/TorrServer "&" 

or "exit 0"
the router begin make my brain and don’t reboot, or adguard home don’t startup after hard power off, and i don’t have internet working at all because dns.

So can you help me make it work?
I try to make autostart from luci> Startup> [Local Startup] меню by add full path to my binare
like this:

Put your custom commands here that should be executed once

the system init finished. By default this file does nothing.

. /lib/functions/gl_util.sh
remount_ubifs

/overlay/sbin/TorrServer
/overlay/sbin/qbittorrent

exit 0

but its again only one service run not both

That’s my script

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

START=97
STOP=01
PROG=/overlay/sbin/TorrServer
start() {
    # start torrserver
    /overlay/sbin/TorrServer &
}

stop() {
    # stop torrserver
    killall TorrServer
}
#!/bin/sh /etc/rc.common

START=89
STOP=01
PROG=/overlay/sbin/qbittorrent
start() {
    # start qbittorrent
    /overlay/sbin/qbittorrent
}

stop() {
    # stop qbittorrent
    killall qbittorrent
}

log file
logread.zip (20.9 KB)

do some experiments, and have little success, now both bin qbittorrent and torserver start but AdguardHome now don’t start and i have no dns and interner, and as bugs router don’t reboot only hard power of to reboot.

change config to

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

START=99
STOP=01

PROG=/overlay/sbin/TorrServer
start() {
# start torrserver
/overlay/sbin/TorrServer
}

stop() {
# stop torrserver
killall TorrServer
}

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

START=89
STOP=01
PROG=/overlay/sbin/qbittorrent

start() {
# Start qbittorrent
/overlay/sbin/qbittorrent &
}

stop() {
# stop qbittorrent
killall qbittorrent
}

log file
logread_2.zip (21.7 KB)

I note that this is a daemon, and I recommend that you run it in the startup script as a daemon
For example:

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

START=99

USE_PROCD=1

PROG=/overlay/sbin/TorrServer

start_service() {
    procd_open_instance
    procd_set_param respawn
    procd_set_param stderr 1
    procd_set_param command $PROG
    procd_close_instance
}

stop_service() {
    killall -9 /overlay/sbin/TorrServer 2>/dev/null
}
1 Like

Thanks a lot, that helped! Now all binary startup well and have no issues with AdguardHome and No-reboot bugs. :+1:

1 Like