KNX/EIB: System V startscript for eibd


in a previous post I have descriped how to compile the eibd daemon for the Raspberry PI. Here is a sample debian startscript to start eibd at system boot.

Login as root at your EIBd box and  created a user under which the daemon should run.

useradd eibd -s /bin/false -U -M

Create the script eibd in /etc/init.d

#! /bin/sh
# Provides:             eibd
# Required-Start:       $remote_fs $syslog $network
# Required-Stop:        $remote_fs $syslog $network
# Default-Start:        2 3 4 5
# Default-Stop:
# Short-Description:    KNX/EIB eibd server
set -e
export EIBD_BIN=/usr/local/bin/eibd
#export EIBD_OPTIONS="-D -T -R -S -i -u --eibaddr=1.1.128 tpuarts:/dev/ttyS0"
export EIBD_OPTIONS="-d -D -T -R -S -i -u --eibaddr=1.1.128 ipt:"
export EIBD_USER=eibd
test -x $EIBD_BIN || exit 0
umask 022
. /lib/lsb/init-functions
# Are we running from init?
run_by_init() {
    ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
export PATH="/usr/local/bin:${PATH}"
case "$1" in
        log_daemon_msg "Starting eibd daemon" "eibd" || true
        route add dev eth0 > /dev/null 2>&1 || true
        if start-stop-daemon --start --quiet --oknodo -c $EIBD_USER --exec $EIBD_BIN -- $EIBD_OPTIONS; then
            log_end_msg 0 || true
            log_end_msg 1 || true
        log_daemon_msg "Stopping eibd daemon" "eibd" || true
		route delete > /dev/null 2>&1 || true
        if start-stop-daemon --stop --quiet --oknodo --exec $EIBD_BIN; then
			log_end_msg 0 || true
            log_end_msg 1 || true

        log_daemon_msg "Restarting eibd daemon" "eibd" || true
        start-stop-daemon --stop --quiet --oknodo --retry 30 --exec $EIBD_BIN
        if start-stop-daemon --start --quiet --oknodo --exec $EIBD_BIN -c $EIBD_USER --exec $EIBD_BIN -- $EIBD_OPTIONS; then
            log_end_msg 0 || true
            log_end_msg 1 || true

        status_of_proc $EIBD_BIN eibd && exit 0 || exit $?

        log_action_msg "Usage: /etc/init.d/eibd {start|stop|restart|status}" || true
        exit 1
exit 0

Make it executable
chmod +x /etc/init.d/eibd
And update your configuration
update-rc.d eibd defaults

See the next post with an Upstart based script.

Michael PuTTY

Advertisment to support

13 thoughts on “KNX/EIB: System V startscript for eibd”

  1. Since you are using network-related commands in this script, you should also make it depend on $network, like:

    # Required-Start: $remote_fs $syslog $network
    # Required-Stop: $remote_fs $syslog $network

  2. Hi Michael,

    when I reboot or start my PI the eibd daemon fail to start.
    If I login and call by hand the script, every commands works fine (start,stop status) and also the daemon work fine.
    I use the IP interface.
    Do you have some ideas ?

  3. Hi Michael,
    I have this msg in the log file:

    Layer 2(0051C988,54E4791E) Open
    initialisation of the backend failed


  4. Hi Michael,
    I use your script:
    -d -D -T -R -S -i -u –eibaddr=1.1.128 ipt:
    with this modified option:
    ipt: form my lan and knx interface
    –trace=65535 (I don’t know the value for different levels)
    When I had install I had enable also usb.

    1. Hi Hans,

      maybe eibd tries to start while the network interface isn’t up yet or isn’t reachable?


      1. Maybe. I also think this. I have added the istructions:
        at required-start and required-stop but I don’t know how log the boot sequence of the services.
        Thanks for your help.

        1. Hi Hans,

          yes this is the right way to add a dependency but in my opinion you have to disable and enable the eibd init script to get it this active. Something like this:

          update-rc.d eibd remove && insserv eibd && update-rc.d eibd defaults


          1. Hi Michael,

            When I have changed init script (/etc/init.d/eibd) I have used only update-rc.d utility
            without insserv…
            Now I have tried your command line.
            Nothing happened.
            To test I inserted a pause of 5 sec. (sleep 5) before the start of daemon.
            Now work.
            What it wait ? Mah.
            I will study the Debian init and boot instructions…


          2. When I add the slepp command in the init script it works. It is possible that the network script not completed? Waite for DHCP?

          3. Hi Thomas,

            yes, please set a set static IP Address. There is something strange in the default network config of raspbian because of an additional running dhcpcd V 5 client. I don’t know why this daemon is running because the network scripts configures the interfaces also by dhcp.


  5. Hi Michael,
    i have installed your script.
    i send on the knx with software ETS3 the group address with the connection at the Raspberrypi Ip address, and i change the light ON or OFF, but i don’t receive the status group address. Is possible receive the group address from USB to raspberry and from raspberry to IP PC connected?
    Thanks for your help.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.