|
Post by demondreamer on Feb 13, 2015 16:56:11 GMT
I'm looking for a way to view the OpenHAB event bus running on the RaspberryPi remotely from my PC. When I used to run OpenHAB on my PC, it ran in a command window that remained open the whole time. It displayed in real time everything OpenHAB was doing, status, errors, commands received and sent, etc. It was very useful in understanding and troubleshooting what OpenHAB was doing.
The closest I've come up with so far is using WinSCP to FTP into the root account and viewing:
/var/log/openhab/events.log
and
/var/log/openhab/openhab.log
of course I have to close and reload if I want an updated version of the log to display.
Does anyone know of a better way?
-Demondreamer
|
|
|
Post by computourist on Feb 13, 2015 17:54:16 GMT
You can start Openhab manually using a remote terminal program like Putty:
log in and: > cd /opt/openhab > sudo ./start.sh
and you'll see events in realtime..
- Computourist
|
|
|
Post by camblonie on Feb 13, 2015 19:13:17 GMT
DD, I went back to running from a PC so I can make quick changes but eventually I'll move back to the Pi. There seem to be 20 different ways to automatically start OpenHAB on the pi. Did you follow a particular instruction that is working well?
|
|
|
Post by demondreamer on Feb 15, 2015 4:53:02 GMT
Camblonie, I'd love to tell you but I can't remember what instructions I followed. I vaguely remember getting the Pi about a month ago and going through the update process and whatnot. I Followed the instructions on the OpenHAB website (I think) to get it installed using apt-get. As far as it auto starting, it either just does it or I can't find the webpage I followed in my history. Yeah, not much help, I know. I think I was focused on getting computourist's scripts to work for me at that time.
One thing I do know is that /opt/openhab doesn't exist, nor can I seem to find start.sh anywhere on the file system. So.. no realtime console for me? lol
As far as Pi vs computer Openhab, I've found that using WinSCP, browsing to the configuration files on the Pi and opening the file with Notepad++ via WinSCP, when I hit save in Notepad++, it saves the file on the Pi and Openhab picks it up within a minute or so. In the OpenHAB main configuration you can set how often it checks for changes, and I have mine set to 1 minute. It's just as fast as on the PC.
-Dd
|
|
|
Post by camblonie on Feb 15, 2015 18:32:39 GMT
Dd, You have the start.sh file somewhere or it wouldn't be running. Did you search from WinSCP for the openhab folder? There was some traffic about using APT-Get vs other methods putting things in different locations on the Pi but the Google Plus group is a joke for searching. A question I would have is what happens when you don't stop the already running OpenHAB? Do you then have two servers running?
|
|
|
Post by demondreamer on Feb 15, 2015 22:51:58 GMT
Dd, You have the start.sh file somewhere or it wouldn't be running. Did you search from WinSCP for the openhab folder? There was some traffic about using APT-Get vs other methods putting things in different locations on the Pi but the Google Plus group is a joke for searching. A question I would have is what happens when you don't stop the already running OpenHAB? Do you then have two servers running? I've searched high and low for start.sh, it doesn't exist. Also I wouldn't say i have an openhab folder, more like folders, scattered all over the place. below is a partial list of some of them, found by doing a search for "*openhab*". /etc/openhab/configurations/ /etc/default/openhab --- some settings for openhab/etc/init.d/openhab --- start/stop/restart/etc openhab /usr/share/openhab/configurations/ ---openhab items/rules/sitemaps/etc /usr/share/openhab/server/plugins/ /usr/share/openhab/addons/ ---my openhab addons/var/run/openhab.pid /var/cache/apt/archives/ ---apt-get downloads here /var/lib/openhab/workspace/ /var/lib/dpkg/info/ /var/log/openhab/ --- log files here I found this: openhab-runtime_1.6.1_all.deb in /var/cache/apt/archives/ along with the other openhab bundles I initially downloaded. So I suppose I apt-get the 1.6.1_all_deb version back then. the /etc/init.d/openhab file is how OpenHAB is getting started at boot I think. I can start|stop|status|restart|force-reload using it, but.... no console. Here's the contents of /etc/init.d/openhab : #! /bin/sh
### BEGIN INIT INFO
# Provides: openhab
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: openHAB server
# Description: Start / Stop openHAB server
### END INIT INFO
# Author: Theo Weiss <theo.weiss@gmail.com>
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="openHAB server"
NAME=openhab
OPENHAB_CONF_DIR="/etc/openhab"
OPENHAB_DIR="/usr/share/openhab"
OPENHAB_LOG_DIR="/var/log/openhab"
OPENHAB_WORKSPACE_DIR="/var/lib/openhab/workspace"
JAVA="/usr/bin/java"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
LAUNCHER=`ls ${OPENHAB_DIR}/server/plugins/org.eclipse.equinox.launcher_*.jar`
# Exit if the package is not installed
if [ ! -r "$LAUNCHER" ]; then
log_failure_msg "launcher jar is missing"
exit 5
fi
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
if [ x"${OPENHAB_JAVA}" != x ]; then
JAVA="${OPENHAB_JAVA}"
fi
if [ x"${USER_AND_GROUP}" != x ]; then
USER=`echo ${USER_AND_GROUP} | cut -d ":" -f 1`
GROUP=`echo ${USER_AND_GROUP} | cut -d ":" -f 2`
#Check whether the specified user exists
if ! getent passwd "${USER}" > /dev/null 2>&1; then
log_failure_msg "runtime user doesn't exists"
exit 2
fi
#Check whether the specified group exists
if ! getent group "${GROUP}" > /dev/null 2>&1; then
log_failure_msg "runtime group doesn't exists"
exit 2
fi
# Check whether the specified user is member of "openhab" group
USER_ID=`id --user ${USER}`
if [ "${USER_ID}" != "0" ]; then
MEMBER_OF=`id --groups --name "${USER}" | tr " " "\n"`
for MEMBER_OF_GROUP in ${MEMBER_OF}; do
if [ "${MEMBER_OF_GROUP}" = "openhab" ]; then
IS_MEMBER="true"
fi
done
if [ "${IS_MEMBER}" != "true" ]; then
log_failure_msg "runtime user isn't member of 'openhab' group"
exit 2
fi
fi
EXTRA_ARGS="-c "${USER_AND_GROUP}" --umask 002 --background --make-pidfile --chdir ${OPENHAB_DIR}"
else
EXTRA_ARGS="--umask 002 --background --make-pidfile --chdir ${OPENHAB_DIR}"
fi
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
DEBUG_ARGS="-Xdebug \
-Xnoagent \
-Djava.compiler=NONE \
-Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n \
-Dlogback.configurationFile=${OPENHAB_CONF_DIR}/logback_debug.xml"
JAVA_ARGS_DEFAULT="-Dosgi.clean=true \
-Declipse.ignoreApp=true \
-Dosgi.noShutdown=true \
-Djetty.port=${HTTP_PORT} \
-Dopenhab.configfile="${OPENHAB_CONF_DIR}/configurations/openhab.cfg" \
-Dopenhab.configdir="${OPENHAB_CONF_DIR}/configurations" \
-Dopenhab.logdir="${OPENHAB_LOG_DIR}" \
-Djetty.home="${OPENHAB_DIR}" \
-Djetty.port.ssl=${HTTPS_PORT} \
-Djetty.config="${OPENHAB_CONF_DIR}/jetty" \
-Djetty.logs="${OPENHAB_LOG_DIR}" \
-Djetty.rundir="${OPENHAB_DIR}" \
-Dfelix.fileinstall.dir="${OPENHAB_DIR}/addons" \
-Djava.library.path="${OPENHAB_DIR}/lib" \
-Djava.security.auth.login.config="${OPENHAB_CONF_DIR}/login.conf" \
-Dorg.quartz.properties="${OPENHAB_CONF_DIR}/quartz.properties" \
-Dequinox.ds.block_timeout=240000 \
-Dequinox.scr.waitTimeOnBlock=60000 \
-Dfelix.fileinstall.active.level=4 \
-Djava.awt.headless=true \
-jar ${LAUNCHER} \
-configuration ${OPENHAB_WORKSPACE_DIR} \
-data ${OPENHAB_WORKSPACE_DIR} \
-console ${TELNET_PORT}"
if [ x"${JAVA_ARGS}" != x ]; then
JAVA_ARGS_DEFAULT="${JAVA_ARGS} ${JAVA_ARGS_DEFAULT}"
fi
if [ x"${OPENHAB_ARGS}" != x ]; then
JAVA_ARGS_DEFAULT="${JAVA_ARGS_DEFAULT} ${OPENHAB_ARGS}"
fi
if (echo ${DEBUG} | grep -qi "^yes$"); then
JAVA_ARGS_DEFAULT="${DEBUG_ARGS} ${JAVA_ARGS_DEFAULT}"
else
JAVA_ARGS_DEFAULT="-Dlogback.configurationFile=${OPENHAB_CONF_DIR}/logback.xml ${JAVA_ARGS_DEFAULT}"
fi
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
if start-stop-daemon --start --quiet --pidfile $PIDFILE $EXTRA_ARGS \
--oknodo --exec $JAVA -- $JAVA_ARGS_DEFAULT
then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
if start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile $PIDFILE --oknodo
then
rm -f $PIDFILE
log_end_msg 0
else
log_end_msg 1
fi
;;
status)
status_of_proc "$JAVA" "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
if start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile $PIDFILE --oknodo
then
rm -f $PIDFILE
if start-stop-daemon --start --quiet --pidfile $PIDFILE $EXTRA_ARGS \
--oknodo --exec $JAVA -- $JAVA_ARGS_DEFAULT
then
log_end_msg 0
else
log_end_msg 1
fi
else
log_end_msg 1
fi
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
|
|
|
Post by computourist on Feb 16, 2015 8:42:44 GMT
@ demondreamer: I see the difference: you installed the distribution package, I downloaded and installed the zip-file. ( as described in www.instructables.com/id/OpenHAB-on-Raspberry-Pi/ ) Starting and stopping Openhab in your case is done thru " sudo service openhab start/stop/restart" instead of using start.sh as I do. You should be able to follow the logfile entries using the " tail -f logfilename" command, that will print out the last part of the logfile as it grows. - Computourist
|
|
|
Post by demondreamer on Feb 16, 2015 18:55:06 GMT
Ahh, there we go. That's exactly what I'm looking for.
Thank you!
Demondreamer
|
|