Automatic restart

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
Posts: 133
Joined: 10 Apr 2013 09:43

Automatic restart

Post by Isaksson » 04 Apr 2017 22:39

Sometimes my z-way-server crashes, it could be hour, days or month between the crashes so its hard to know when it will happen and it is always frustrating when it occurs because you will notice it when the lights not comes on or when you try to control something and it does not work.

I have no solution for the crashes but I have a workaround that will restart the service when it crashes.
I just installed this tonight and I have verified it by stopping the service and I see no reason that this will fail in the long run.

Simple instruction on how I did this.

Install monit:
sudo apt-get install monit

Modify the config to change the check interval(optional step):
sudo nano /etc/monit/monitrc
set daemon 120
enable monit webserver at port 2812 with login username admin and password monit(optional step):
set httpd port 2812 and
allow admin:monit

Save the file and create a new config file with the following content:
sudo nano /etc/monit/conf.d/z-way-server

check process z-way-server with match z-way-server
start program = "/etc/init.d/z-way-server start"
stop program = "/etc/init.d/z-way-server stop"

save the file

last command to initialize monit with new config:
sudo monit reload

Now monit will start z-way-server if it does not run.
If you have enabled the web server then you could monitor this at http://ip:2812

Posts: 50
Joined: 07 Feb 2016 16:29

Re: Automatic restart

Post by micky1500 » 04 Apr 2017 23:18

Thanks Isaksson
Will be installing monit tomorrow.
Since 2.3.0 I have noticed 3 times now that the z-way server had shut itself down, nothing in the normal log to explain the reason.
restart of z-way server and it works again for a long time.
Guessing the z-way watchdog monitor has got broken in this last update..

And nice instructions on how to setup monit :)
Raspi 3, 2.3.7

Posts: 133
Joined: 10 Apr 2013 09:43

Re: Automatic restart

Post by Isaksson » 04 Apr 2017 23:37

Thanks :)

I hope you will find it useful.

And about the instructions, there is so many post with instructions where the authors have left out many steps that they assume the user should know and that is just bad ;)
The meaning with a post like this is that anyone with the knowledge to install z-way could install this without any special skills.

Posts: 133
Joined: 10 Apr 2013 09:43

Re: Automatic restart

Post by Isaksson » 04 Apr 2017 23:45

Just have to say that I have already been "saved" by this.
Log file is great to keep track of how often this happens.

Code: Select all

[MSK Apr  4 21:47:46] error    : 'z-way-server' process is not running
[MSK Apr  4 21:47:46] info     : 'z-way-server' trying to restart
[MSK Apr  4 21:47:46] info     : 'z-way-server' start: /etc/init.d/z-way-server
[MSK Apr  4 21:49:46] info     : 'z-way-server' process is running with pid 16666
You will find the log file in this location by default:


User avatar
Z-Wave Support
Posts: 318
Joined: 21 Oct 2016 15:49

Re: Automatic restart

Post by Z-Wave Support » 05 Apr 2017 09:11

Hello Isaksson,

can you help us, please.

Please make a log with the following guidance and send this to

1. open PuTTY (SSH Client)
2. stop Z-Way-Server: “$ sudo /etc/init.d/z-way-server stop”
3. switch to the Z-Way-Server directory: “$ cd /opt/z-way-server”
4. start Z-Way-Server with gdb debugger (should be installed): “$ LD_LIBRARY_PATH=./libs gdb ./z-way-server”
5. type in ‘r’ for start
6. confirm one time with ‘c’ for continue
7. Z-Way-Server is starting…

When the server crashes, a message like this one appears:

“Program received signal SIGINT, Interrupt.
0xb6403360 in nanosleep () at ../sysdeps/unix/syscall-template.S:81
81 ../sysdeps/unix/syscall-template.S: No such file or directory.”

with an input prompt.
There you have to type in: ‘info thread’ and copy the log, then type in ‘bt’ and copy this log aswell.

After this, you can exit the debugger with ‘q’ for quit and restart it with: “$ sudo /etc/init.d/z-way-sever restart”

If the port 8083 is still occupied, then please stop the Z-Way-Server manually with: “$ sudo killall -9 z-way-server”.


Some additional commands for the debugger:

If you log on as a root user, then you should not receive error messages. Use: “$sudo su” and then start this with the debugger.

The best would be, to do that within one screen session.
1. “$screen” (you have to install that eventually, you can do this with: “$sudo apt-get install screen”)
2. $sudo su (root user)
3. and then please follow the instructions for the gdb procedure…

The advantage of this, is that this can be active in the background.
You can log out of the session with: “$detach” and when you reconnect through SSH, then you will be logged in at the appropriate point.
You can alternatively keep that window open.
“$exit” will end the screen session within the session.

Here is more about that:

Thank you
Z-Wave Support

Posts: 133
Joined: 10 Apr 2013 09:43

Re: Automatic restart

Post by Isaksson » 05 Apr 2017 14:46

Sure, I have now turned of the automatic restart of service and I am now running it in gdb mode.

Posts: 5
Joined: 20 Mar 2017 14:56

Re: Automatic restart

Post by ThePostman » 02 Aug 2017 18:10

It would be nice to see the debug instructions in the FAQ. Once in a while I have to search the forum for these instructions.

Post Reply