# Init script on OpenWRT, without systemd?

**URL:** https://forum.gitea.com/t/init-script-on-openwrt-without-systemd/11502
**Category:** Install/Maintain/Configure
**Created:** [July 9, 2025, 9:29pm UTC](https://forum.gitea.com/t/init-script-on-openwrt-without-systemd/11502 "2025-07-09T21:29:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jackm](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jackm](https://forum.gitea.com/u/jackm)
#### Post date: [July 9, 2025, 9:29pm UTC](https://forum.gitea.com/t/init-script-on-openwrt-without-systemd/11502/1 "2025-07-09T21:29:09Z")

</div>

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

```auto
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

---

<div class="post-metadata">

### Author: ![jackm](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jackm](https://forum.gitea.com/u/jackm)
#### Post date: [July 11, 2025, 5:09am UTC](https://forum.gitea.com/t/init-script-on-openwrt-without-systemd/11502/2 "2025-07-11T05:09:00Z")

</div>

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

```auto
!/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

```auto
/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)
