This page last changed on May 23, 2013 by othmark.

I am trying to start OpenRemote via a crontab process, so that after a reboot the controller comes back up automatically.
The problem is, that I cannot get the ../webapps/controller/controller.xml file loaded when starting OpenRemote from outside the OpenRemote.../bin directory. (Crontab starts at the user home directory). I believe I set PATH and environment variables correct:

export PATH="$HOME/shProject:$HOME/shProject/ORC/bin:$HOME/shProject/ORC/webapps/controller:$PATH"
export CATALINA_HOME="$HOME/shProject/ORC"
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home"

The server starts, however the controller definition file ../webapps/controller/../webapps/controller/controller.xml is not loaded. (Of course it is there, and when starting the server from within the OpenRemote.../bin directory everything loads.)

The error message from the server is:

Could not find a controller definition to load at path '../webapps/controller/controller.xml' (for version 2.0)
INFO 2013-05-23 10:33:13,436 : Controller Definition File Watcher for Default Deployer started.

Is there some other environment variable or PATH I need to specify?

I am running OS X 10.8.3, but I assume the problem for Linux would be similar.

Any hint would be appreciated.

Best regards,

Othmar

I've zero knowledge of crontab: on Linux side the scripts do change to bin directory before starting. Maybe it is necessary for crontab to change the working directory as well? The PATH variable is not used when resolving the location of the controller.xml but it is a relative path instead. This is defined in the config.properties:

##
# RESOURCE FILE CONFIGURATION:
#
#  The resource path below points to a directory where the controller
#  looks for all  configuration files  (XML files),  images and other 
#  resources for panels and controllers.
#
#  With the default  distribution of  OpenRemote controller,  it is not 
#  necessary to change this location.
##
resource.path=../webapps/controller

Automated start on linux server

HTH

Posted by juha at May 23, 2013 12:12

When using cron to start programs via crontab there is a different PATH variable used. Please study this post http://stackoverflow.com/questions/10129381/crontab-path-and-user

Posted by aktur at May 24, 2013 14:32

Juha, Michal,

thanks for your help. As Juha proposed I am now using a shell script, which is changing to the OR working directory:

#!/bin/sh
cd /Users/smarthome/shproject/ORC/bin
./openremote.sh run

This script then I start with crontab at reboot, with its output logging to orReboot.log

@reboot /Users/smarthome/orBoot.sh > /Users/smarthome/orReboot.log 2>&1

Thanks again,

Othmar

Posted by othmark at May 24, 2013 19:14
Document generated by Confluence on Jun 05, 2016 09:40