Got time to play with this (again) so here is a more “detailed” instruction list…
connect via ssh with root / password (find it on the bottom of the unit)
run:
opkg update
run:
opkg install nano ser2net
now let’s disable auto starting stuff…
run:
crontab -e
then:
pres “i” to enter editor mode then use arrow keys to put the promopt before 1st and third line and put a # in front, then press escape (without commas)
i, #, down, down, #, esc
it should look like
#*/1 * * * * /usr/bin/Rotate_Logs.sh #Rotate_Logs
#20 02 * * * //usr/bin/mios-service-sync_ergy.sh #Sync_Ergy
^- notice the # at the start of the line
to save modifications, press (without commas)
:,w,q,[enter]
Now lets edit a bash file so it does not do anything…
cp /usr/bin/Start_LuaUPnP.sh /usr/bin/Start_LuaUPnP.sh
nano /usr/bin/Start_LuaUPnP.sh
now write the text so it looks like this at the start:
#!/bin/sh
sleep 120
exit
now press [control+o] then [control+w] to save
do the same with:
/usr/bin/Start_serproxy.sh
now let’s create a new file with
nano ~/check.sh
with contents:
COUNT=$( netstat -a | grep -i listen | grep -i "0.0.0.0:7676" | wc -l )
echo "Found $COUNT"
if [ "$COUNT" == "0" ] ; then
echo "Killing..."
kill -9 $( pgrep -f "Start_LuaUPnP" )
kill -9 $( pgrep -f "Start_serproxy" )
kill -9 $( pgrep -f "serproxy" )
kill -9 $( pgrep -f "lighttpd -f" )
kill -9 $( pgrep -f "LuaUPnP" )
kill -9 $( pgrep -f "/etc/cmh-ra/keys/cmh-ra-key.priv" )
kill -9 $( pgrep -f "cmh-ra-daemon.sh" )
kill -9 $( pgrep -f "cmh_PnP" )
echo "Starting..."
ser2net -C "7676:raw:0:/dev/ttyS0:115200 8DATABITS NONE 1STOPBIT"
else
echo "Already started"
fi
Press controll+o and controll+w to save it.
Now run
chmod +x check.sh
We can run it with
./check.sh
It will say somehting like
netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Found 0
Killing…
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
Starting…
If we run it again…
./check.sh
netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Found 0
Killing...
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
Starting...
root@MiOS_45103975:~#
root@MiOS_45103975:~#
root@MiOS_45103975:~#
root@MiOS_45103975:~# ./check.sh
netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Found 1
Already started
All ok!
Now let’s edit crontab to make this run every minute so our port is always exposed if vera restarts…
nano /etc/crontabs/root
and add the line
*/1 * * * * /root/check.sh
^- this means every minute, change to something else if you want…
then control+o then control+w
the reboot with
reboot
now after reboot reconnect with ssh and only run
netstat -a | grep -i listen | grep "7676"
and after 1-2 minutes you should see a line with
tcp 0 0 0.0.0.0:7676 0.0.0.0:* LISTEN
this means all is working fine!
so even if it reboots, vera will restart the tcp server for the zwave chip
Enjoy!