1

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?

Don
  • 235
  • 2
  • 4
  • 16

2 Answers2

2

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.

Wintermute
  • 42,983
  • 5
  • 77
  • 80
  • What happens if two or more scripts have the same start number? – Don Jan 24 '15 at 15:23
  • Currently they are executed in lexicographical order (i.e., those whose first letter has the lower ASCII value is executed first, if they're the same the second letter decides and so forth). I wouldn't depend on that, though; future versions may try to parallelize, for example. – Wintermute Jan 24 '15 at 15:31
  • So to put it simply, it won't cause any errors if you put the same start number in two or more scripts ? – Don Jan 24 '15 at 15:33
  • Not unless those two scripts depend on being executed in a particular order, no. – Wintermute Jan 24 '15 at 15:35
0

It's just some variables that you can use later in your configuration file. You can access the value stored in a variable prefix its name with the dollar sign "$":

NAME="Hello world"
echo $NAME
Alex
  • 1,986
  • 22
  • 23