What exactly do you mean by correct directory?
Z-Way is running in /opt/z-way-server/
The daemon script is located in /etc/init.d/
I can use z-way, but only if i start it manually by going into /opt/z-way-server and executing ./z-way-server.
This is the regular init.d script to start the daemon:
Code: Select all
#! /bin/sh
### BEGIN INIT INFO
# Provides: z-way-server
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: RaZberry Z-Wave service
# Description: Start Z-Way server for to allow Raspberry Pi talk with Z-Wave devices using RaZberry
### END INIT INFO
# Description: RaZberry Z-Way server
# Author: Yurkin Vitaliy <aivs@z-wave.me>
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=z-way-server
DAEMON_PATH=/opt/z-way-server
PIDFILE=/var/run/$NAME.pid
# adding z-way libs to library path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/z-way-server/libs
case "$1" in
start)
echo -n "Starting z-way-server: "
start-stop-daemon --start --pidfile $PIDFILE --make-pidfile --background --no-close --chdir $DAEMON_PATH --exec $NAME > /dev/null 2>&1
echo "done."
;;
stop)
echo -n "Stopping z-way-server: "
start-stop-daemon --stop --quiet --pidfile $PIDFILE
rm $PIDFILE
echo "done."
;;
restart)
echo "Restarting z-way-server: "
sh $0 stop
sleep 10
sh $0 start
;;
save)
echo "Saving z-way-server configuration"
PID=`sed s/[^0-9]//g $PIDFILE`
/bin/kill -10 $PID
;;
*)
echo "Usage: /etc/init.d/z-way-server {start|stop|restart|save}"
exit 1
;;
esac
exit 0
By uncommenting "# > /dev/null 2>&1" i get the following error/Output:
Code: Select all
Starting z-way-server: start-stop-daemon: unrecognized Option '--no-close'
If i delete the '--no-close' Parameter, i get the following Output:
Code: Select all
Starting z-way-server: start-stop-daemon: unable to stat z-way-server (No such file or Directory)
So i deleted the '--chdir' Attribute, the line now looks like this:
Code: Select all
start-stop-daemon --start --pidfile $PIDFILE --make-pidfile --background --exec $DAEMON_PATH/$NAME # > /dev/null 2>&1
With this line i can start the daemon, no error messages.
BUT: i get the "Error handling data from Server"-Error when i access the webinterface.
The same happens when i try to start z-way-server like this
The only way to get it working properly is with these commands:
Code: Select all
cd /opt/z-way-server && ./z-way-server
How do i have to modify the init.d-script to start z-way properly?