Init script on OpenWRT, without systemd?

Hi,
i’m setting up a new router (Banana Pi R3) running OpenWRT and i’m setting up a number of services.

Gitea was installed natively, not as a docker container. It is not the first time i install gitea on a machine, but it’s the first time it’s on a machine not running systemd.

Looking around somewhere i saw i can start gitea this way, by adding this line to /etc/rc.local

sudo -u git /bin/ash -c 'GITEA_WORK_DIR=/gitea/ /gitea/bin/gitea web -c /etc/gitea/app.ini'

and gitea is started and running succesfully without problem for more than 24 hours.

however, if gitea is started this way two problems arises:

  • reboot doesn’t work. reboot -f does (i guess because root can’t shut down processes from user git?)
  • samba doesn’t work. i have to start it manually. I can’t start it from rc.local, though. I have to start it from a shell after the system has booted… and that is extremely convenient.

I am pretty sure the problem lies in how i am starting gitea, but i don’t know how to do it without systemd.
What can i try?
thanks

Replying as i can’t seem to find a way to edit the OP?
I think i got it: add a new script at /etc/init.d

!/bin/sh /etc/rc.common

START=99

start() {
    echo Start Gitea
    sudo -u git /bin/ash -c 'GITEA_WORK_DIR=/gitea/ /gitea/bin/gitea web -c /etc/gitea/app.ini'
}

and of course then calling

/etc/init.d/gitea enable

then reboot.

Initially this was not working because i put START > 100 to make sure it was the last service to be started. In my ignorance i thought there was not an upper limit (well, maybe 2^32-1)