Hi,
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 ### BEGIN INIT INFO # 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 ### END INIT INFO 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:192.168.56.1" 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 start) log_daemon_msg "Starting eibd daemon" "eibd" || true route add 224.0.23.12 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 else log_end_msg 1 || true fi ;; stop) log_daemon_msg "Stopping eibd daemon" "eibd" || true route delete 224.0.23.12 > /dev/null 2>&1 || true if start-stop-daemon --stop --quiet --oknodo --exec $EIBD_BIN; then log_end_msg 0 || true else log_end_msg 1 || true fi ;; restart) 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 else log_end_msg 1 || true fi ;; status) status_of_proc $EIBD_BIN eibd && exit 0 || exit $? ;; *) log_action_msg "Usage: /etc/init.d/eibd {start|stop|restart|status}" || true exit 1 esac 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
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
Thanks, Yes, of course. I’ve altered the dependencies.
Michael
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 ?
Thanks.
Hi Michael,
I have this msg in the log file:
Layer 2(0051C988,54E4791E) Open
initialisation of the backend failed
Thanks.
Hi Hans,
which eibd parameters do you set?
Michael
Hi Michael,
I use your script:
-d -D -T -R -S -i -u –eibaddr=1.1.128 ipt:192.168.56.1
with this modified option:
–daemon=/tmp/eibd.log
–eibaddr=0.0.1
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.
Hi Hans,
maybe eibd tries to start while the network interface isn’t up yet or 192.168.56.1 isn’t reachable?
Michael
Maybe. I also think this. I have added the istructions:
$network
at required-start and required-stop but I don’t know how log the boot sequence of the services.
Thanks for your help.
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
Michael
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…
Thanks.
Hans
When I add the slepp command in the init script it works. It is possible that the network script not completed? Waite for DHCP?
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.
Michael
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.
Stefano