JEMMASelfStarting
Notes/suggestions to employ when JEMMA is used in remote locations (e.g. running on a Raspberry).
Screen is a simple tool to allow applications to run in background and be "re-attached" locally when needed. They can also be used with other utilities such as screenie to simplify their usage.
A simple script to launch jemma inside a screen in back ground follows (/home/pi/start_screen.sh
):
#!/bin/bash
JEMMADIR=/home/pi/jemma
cd $JEMMADIR
echo launching - screen -d -m bash $JEMMADIR/start.sh
screen -d -m ./start.sh
There are several ways to do this. A simple way could be adding this line inside /etc/rc.local
su pi -c /home/pi/start_screen.sh
In case of reboot it is important to keep devices associated. In order to avoid de-association, the best is to rely on the Non-Volatile Memory (NVM) of ZigBee dongles. This can be done by adding the following lines to org.energy_home.jemma.ah.zigbee.properties
file in osgi-instance-area
:
#Thu Nov 12 11:00:20 UTC 2015
usenvm=true
Nightly reboots can be life-savers, in case the gateway gets stuck for some reason.
This can be achieved e.g. by creating a file such as /etc/cron.d/zz-reboot
with this content:
30 03 * * * root /sbin/reboot
This will reboot the gateway every night at 3:30 AM.
Many people in the JEMMA community use openvpn. The configuration is project-specific, but it generally boils down to generating dedicated certificates for each gateway (e.g. with xca) and deploying the GW certificates and key + the CA certificate in the gateway.