Search code examples
linuxbashopenwrtinit.d

What does START=03 mean in /etc/init.d scripts on openwrt?


I see a lot of patterns like that in /etc/init.d/:

START=03
START=40
START=96
etc...

For instance this script:

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

    START=03

    start () {
    udevd --daemon
    }

stop() {
killall -9 udevd
}

What do those numbers actually mean?


Solution

  • In this context, START and STOP are used to specify the boot order. Scripts with START=10 will be run after scripts with START=9 but before those with START=11, and scripts with a lower STOP number will be stopped before those with a higher one.

    More precisely: The variables determine what /etc/rc.common will call the symlinks to those scripts in /etc/rc.d when it is asked to enable/disable them. There will be /etc/rc.d/S${START}scriptname and /etc/rc.d/K${STOP}scriptname, and those will be run in the order specified at start and shutdown respectively.

    See also the section about init scripts in the OpenWrt documentation.