In order not to destroy the SD card on my RPi running OH2, I mount /var/log on tmpfs instead of a persistent filesystem (with the obvious drawback of not being able to keep logs across reboots).
When changing this, I had the problem of the OH2 daemon not starting up, even if the init.d script says startup was successful. By strace:ing /usr/share/openhab2/runtime/karaf/bin/start
, I tracked down the error to the /var/log/openhab2
directory not existing (I assume it was created during package install - I run from the CI APT channel, (deb https://openhab.ci.cloudbees.com/job/openHAB-Distribution/ws/distributions/openhab-offline/target/apt-repo/) ).
To work around the problem, I added the following lines to /etc/rc.local
mkdir -p /var/log/openhab2
chown openhab /var/log/openhab2
I don’t know if this is a desired/supported configuration and if this is to be treated as a bug. One way to help doing what I try to do would be to `mkdir -p´ the log path at daemon start instead of package install (assuming that is the case)