Hi
After some time I got the zwave.me usb stick and software working on my synology DS210j NAS.
When I log on to the NAS via putty terminal I can run the Run_Z-Agent.sh script and everything works fine.
I'm having trouble getting the script to run automatically either from startup (/etc/rc.local) or from /etc/crontab.
I'm not very knowledgeable in linux but I've found on google that cron uses a different environment and that if something goes wrong full paths should be added to commands. I've tried this but to no avail.
The result is that when booted up I have the following relevant processes:
/bin/sh /volume2/zwave/Run_Z-Agent.sh
/opt/bin/sleep 1 (which is in the Run_Z-Agent.sh loop)
When I start the script manually this process is included
/volume2/zwave/z-agent -s z-cloud.z-wave.me --cacert /volume2/Certificates/cacert.pem --cert /volume2/Certificates/cert.pem --key /volume2/Certificates/cert.key -d /dev/usb/ttyUSB0
And the sleep command is not a constant process.So it seems something is going wrong with calling z-agent in the loop.
Any help would be appreciated.
Run_Z-Agent.sh in cron
I got it working by adding
I got it working by adding
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
to the script.
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
to the script.
Good that you found the solution!
You can also substituteLD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
<command>by one lineLD_LIBRARY_PATH=/usr/local/lib <command>This is allowed in bash and sh. This syntax just the variable only for the executed command and not for whole shell environment.
export LD_LIBRARY_PATH
<command>by one lineLD_LIBRARY_PATH=/usr/local/lib <command>This is allowed in bash and sh. This syntax just the variable only for the executed command and not for whole shell environment.
rc.local or cron?
Is there a preference for either solution /etc/rc.local or in /etc/crontab? I am inclined to add it to rc.local
Since 29-12-2016 I am no longer a moderator for this forum
We suggest in rc.local
It is the right place to execute user scripts
Process dying after a while
I compiled the z-agent on my nas (DS212) and am using the drivers installedby the Synozwave package.
I am currently not launching the agent via crontab or rc script but via telnet in background (&) but after a while the process dies.
I checked the log but, at least it seems to me, there is no sign of interruption.
The only thing that occurs to me is that the ssh session from which the script is launched expires after a while, so my suspect is that the process although launched in background "dies" with it.
Should the z-agent be launched in a script for it to be "alive"?
TX in advance
I am currently not launching the agent via crontab or rc script but via telnet in background (&) but after a while the process dies.
I checked the log but, at least it seems to me, there is no sign of interruption.
The only thing that occurs to me is that the ssh session from which the script is launched expires after a while, so my suspect is that the process although launched in background "dies" with it.
Should the z-agent be launched in a script for it to be "alive"?
TX in advance
Of course if your ssh session
Of course if your ssh session dies, all running background jobs will die too. This is the Unix way to do things in multiuser environment.
You have two solutions: use &, nohup and disown (this will detach the process from the terminal session completely; please refer to man pages) or use screen utility as "persistant" terminal (screen -rx to return to detached terminal session).
You have two solutions: use &, nohup and disown (this will detach the process from the terminal session completely; please refer to man pages) or use screen utility as "persistant" terminal (screen -rx to return to detached terminal session).
Ty for the very quick reply.
Ty for the very quick reply.
And for the great software
And for the great software
Still not working
Despite having added the command to start the agent in /etc/rc.local
After reboot there's no zagent process running...
I simply added the commands above to the script. If I run it manually all fine.
Rebooting , no way
After reboot there's no zagent process running...
I simply added the commands above to the script. If I run it manually all fine.
Rebooting , no way
This works for me on DS212+
On my DS212+ I have as last line in rc.local
sh /volume1/public/zwave/Z-Connector/Unix/Run_Z-Agent.sh
The script itself is:
#!/bin/ash
cd /volume1/public/zwave/Z-Connector/Unix
while [ 1 ]
do
LD_LIBRARY_PATH=/opt/lib:/usr/local/lib ./z-agent -s z-cloud.z-wave.me --cacert ../Certificates/cacert.pem --cert ../Certificates/cert.pem --key ../Certificates/cert.key -d /dev/ttyUSB0
# substitute /dev/ttyUSB0 by /dev/ttyACM0 or another device depending on the hardware you have
sleep 1 # spare the CPU
done
NOTE: The lines in the script do wrap here. Actually there are only three lines between do and done. The last character in 'ttyUSB0' is a ZERO!
sh /volume1/public/zwave/Z-Connector/Unix/Run_Z-Agent.sh
The script itself is:
#!/bin/ash
cd /volume1/public/zwave/Z-Connector/Unix
while [ 1 ]
do
LD_LIBRARY_PATH=/opt/lib:/usr/local/lib ./z-agent -s z-cloud.z-wave.me --cacert ../Certificates/cacert.pem --cert ../Certificates/cert.pem --key ../Certificates/cert.key -d /dev/ttyUSB0
# substitute /dev/ttyUSB0 by /dev/ttyACM0 or another device depending on the hardware you have
sleep 1 # spare the CPU
done
NOTE: The lines in the script do wrap here. Actually there are only three lines between do and done. The last character in 'ttyUSB0' is a ZERO!
Since 29-12-2016 I am no longer a moderator for this forum