I just came across this doc written by @lewie: https://github.com/eclipse/smarthome/wiki/Scripted-Rule-Support. This in combination with https://github.com/smerschjohann/docker-oh2-jsr223/blob/master/start.sh got me this far:
2017-05-22 15:00:00.855 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'test.py'
To get this far I did:
- Install jython to /opt/jython (not really, it is already installed there for OH1/jython)
- add the following to /etc/default/openhab2
EXTRA_JAVA_OPTS=" -Dpython.home=/opt/jython -Dpython.path=/etc/openhab2/automation/pylib "
CLASSPATH="/opt/jython/jython.jar"
- add this to /etc/init.d/openhab2 if using SysV init in the section after the USER_AND_GROUP block:
if [ -n "${EXTRA_JAVA_OPTS}" ]; then
export EXTRA_JAVA_OPTS
fi
if [ -n ${CLASSPATH} ]; then
export CLASSPATH
fi