Skip to content

Commit

Permalink
Format start scripts and add check for not found equinox launcher
Browse files Browse the repository at this point in the history
If the equinox launcher jar is not present, there was no error message.

Signed-off-by: Sebastian Janzen <[email protected]>
  • Loading branch information
sja committed Mar 12, 2015
1 parent 743bc6c commit d0798b5
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 41 deletions.
55 changes: 37 additions & 18 deletions distribution/openhabhome/start.bat
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
@echo off

:: set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse
set ECLIPSEHOME="runtime\server"

:: set ports for HTTP(S) server
set HTTP_PORT=8080
set HTTPS_PORT=8443

:: get path to equinox jar inside ECLIPSEHOME folder
for /f "delims= tokens=1" %%c in ('dir /B /S /OD %ECLIPSEHOME%\plugins\org.eclipse.equinox.launcher_*.jar') do set EQUINOXJAR=%%c

:: program params
set PROG_ARGS=-Dlogback.configurationFile=./runtime/etc/logback.xml -DmdnsName=openhab -Dopenhab.logdir=./userdata/logs -Dsmarthome.servicecfg=./runtime/etc/services.cfg -Dsmarthome.userdata=./userdata -Dsmarthome.servicepid=org.openhab -Dorg.quartz.properties=./runtime/etc/quartz.properties -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-ssl.xml,etc/jetty-deployer.xml,etc/jetty-https.xml,etc/jetty-selector.xml

:: start Eclipse w/ java
echo Launching the openHAB runtime...
java %PROG_ARGS% -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Djetty.home.bundle=org.openhab.io.jetty -Dorg.osgi.service.http.port=%HTTP_PORT% -Dorg.osgi.service.http.port.secure=%HTTPS_PORT% -Dfelix.fileinstall.dir=addons -Djava.library.path=lib -Dequinox.ds.block_timeout=240000 -Dequinox.scr.waitTimeOnBlock=60000 -Dfelix.fileinstall.active.level=4 -Djava.awt.headless=true -jar %EQUINOXJAR% %* -console
@echo off

:: set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse
set ECLIPSEHOME=server

:: set ports for HTTP(S) server
set HTTP_PORT=8080
set HTTPS_PORT=8443

:: get path to equinox jar inside ECLIPSEHOME folder
for /f "delims= tokens=1" %%c in ('dir /B /S /OD %ECLIPSEHOME%\plugins\org.eclipse.equinox.launcher_*.jar') do set EQUINOXJAR=%%c

IF NOT [%EQUINOXJAR%] == [] GOTO :Launch
echo No equinox launcher in path '%ECLIPSEHOME%' found!
goto :eof

:Launch
:: start Eclipse w/ java
echo Launching the openHAB runtime...
java ^
-Dosgi.clean=true ^
-Declipse.ignoreApp=true ^
-Dosgi.noShutdown=true ^
-Djetty.port=%HTTP_PORT% ^
-Djetty.port.ssl=%HTTPS_PORT% ^
-Djetty.home=. ^
-Dlogback.configurationFile=configurations/logback.xml ^
-Dfelix.fileinstall.dir=addons ^
-Djava.library.path=lib ^
-Djava.security.auth.login.config=./etc/login.conf ^
-Dorg.quartz.properties=./etc/quartz.properties ^
-Dequinox.ds.block_timeout=240000 ^
-Dequinox.scr.waitTimeOnBlock=60000 ^
-Djava.awt.headless=true ^
-Dfelix.fileinstall.active.level=4 ^
-jar %EQUINOXJAR% %* ^
-console
21 changes: 20 additions & 1 deletion distribution/openhabhome/start.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,27 @@ HTTPS_PORT=8443
# get path to equinox jar inside $eclipsehome folder
cp=$(find $eclipsehome -name "org.eclipse.equinox.launcher_*.jar" | sort | tail -1);

if [ -z "$cp" ]; then
echo "Error: Could not find equinox launcher in path $eclipsehome" 1>&2
exit 1
fi

# program args
prog_args="-Dlogback.configurationFile=./runtime/etc/logback.xml -DmdnsName=openhab -Dopenhab.logdir=./userdata/logs -Dsmarthome.servicecfg=./runtime/etc/services.cfg -Dsmarthome.servicepid=org.openhab -Dsmarthome.userdata=./userdata -Dorg.quartz.properties=./runtime/etc/quartz.properties -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-ssl.xml,etc/jetty-deployer.xml,etc/jetty-https.xml,etc/jetty-selector.xml"

echo Launching the openHAB runtime...
java $prog_args -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Djetty.home.bundle=org.openhab.io.jetty -Dorg.osgi.service.http.port=$HTTP_PORT -Dorg.osgi.service.http.port.secure=$HTTPS_PORT -Dfelix.fileinstall.dir=addons -Djava.library.path=lib -Dequinox.ds.block_timeout=240000 -Dequinox.scr.waitTimeOnBlock=60000 -Dfelix.fileinstall.active.level=4 -Djava.awt.headless=true -jar $cp $* -console
java $prog_args \
-Dosgi.clean=true \
-Declipse.ignoreApp=true \
-Dosgi.noShutdown=true \
-Djetty.home.bundle=org.openhab.io.jetty \
-Dorg.osgi.service.http.port=$HTTP_PORT \
-Dorg.osgi.service.http.port.secure=$HTTPS_PORT \
-Dfelix.fileinstall.dir=addons \
-Djava.library.path=lib \
-Dequinox.ds.block_timeout=240000 \
-Dequinox.scr.waitTimeOnBlock=60000 \
-Dfelix.fileinstall.active.level=4 \
-Djava.awt.headless=true \
-jar $cp $* \
-console
62 changes: 41 additions & 21 deletions distribution/openhabhome/start_debug.bat
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
@echo off

:: set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse
set ECLIPSEHOME="runtime\server"

:: set ports for HTTP(S) server
set HTTP_PORT=8080
set HTTPS_PORT=8443

:: get path to equinox jar inside ECLIPSEHOME folder
for /f "delims= tokens=1" %%c in ('dir /B /S /OD %ECLIPSEHOME%\plugins\org.eclipse.equinox.launcher_*.jar') do set EQUINOXJAR=%%c

:: debug options
set DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n

:: program params
set PROG_ARGS=-Dlogback.configurationFile=./runtime/etc/logback_debug.xml -DmdnsName=openhab -Dopenhab.logdir=./userdata/logs -Dsmarthome.servicecfg=./runtime/etc/services.cfg -Dsmarthome.servicepid=org.openhab -Dorg.quartz.properties=./runtime/etc/quartz.properties -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-ssl.xml,etc/jetty-deployer.xml,etc/jetty-https.xml,etc/jetty-selector.xml

:: start Eclipse w/ java
echo Launching the openHAB runtime...
java %DEBUG_OPTS% %PROG_ARGS% -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Djetty.home.bundle=org.openhab.io.jetty -Dorg.osgi.service.http.port=%HTTP_PORT% -Dorg.osgi.service.http.port.secure=%HTTPS_PORT% -Dfelix.fileinstall.dir=addons -Djava.library.path=lib -Dequinox.ds.block_timeout=240000 -Dequinox.scr.waitTimeOnBlock=60000 -Dfelix.fileinstall.active.level=4 -Djava.awt.headless=true -jar %EQUINOXJAR% %* -console
@echo off

:: set path to eclipse folder. If local folder, use '.'; otherwise, use c:\path\to\eclipse
set ECLIPSEHOME=server

:: set ports for HTTP(S) server
set HTTP_PORT=8080
set HTTPS_PORT=8443

:: get path to equinox jar inside ECLIPSEHOME folder
for /f "delims= tokens=1" %%c in ('dir /B /S /OD %ECLIPSEHOME%\plugins\org.eclipse.equinox.launcher_*.jar') do set EQUINOXJAR=%%c

IF NOT [%EQUINOXJAR%] == [] GOTO :Launch
echo No equinox launcher in path '%ECLIPSEHOME%' found!
goto :eof

:Launch
:: debug options
set DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n

:: start Eclipse w/ java
echo Launching the openHAB runtime...
java ^
%DEBUG_OPTS% ^
-Dosgi.clean=true ^
-Declipse.ignoreApp=true ^
-Dosgi.noShutdown=true ^
-Djetty.port=%HTTP_PORT% ^
-Djetty.port.ssl=%HTTPS_PORT% ^
-Djetty.home=. ^
-Dlogback.configurationFile=configurations/logback_debug.xml ^
-Dfelix.fileinstall.dir=addons ^
-Djava.library.path=lib ^
-Dorg.quartz.properties=./etc/quartz.properties ^
-Djava.security.auth.login.config=./etc/login.conf ^
-Dequinox.ds.block_timeout=240000 ^
-Dequinox.scr.waitTimeOnBlock=60000 ^
-Dfelix.fileinstall.active.level=4 ^
-Djava.awt.headless=true ^
-jar %EQUINOXJAR% %* ^
-console
21 changes: 20 additions & 1 deletion distribution/openhabhome/start_debug.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,30 @@ HTTPS_PORT=8443
# get path to equinox jar inside $eclipsehome folder
cp=$(find $eclipsehome -name "org.eclipse.equinox.launcher_*.jar" | sort | tail -1);

if [ -z "$cp" ]; then
echo "Error: Could not find equinox launcher in path $eclipsehome" 1>&2
exit 1
fi

# debug options
debug_opts="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n"

# program args
prog_args="-Dlogback.configurationFile=./runtime/etc/logback_debug.xml -DmdnsName=openhab -Dopenhab.logdir=./userdata/logs -Dsmarthome.servicecfg=./runtime/etc/services.cfg -Dsmarthome.servicepid=org.openhab -Dsmarthome.userdata=./userdata -Dorg.quartz.properties=./runtime/etc/quartz.properties -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-ssl.xml,etc/jetty-deployer.xml,etc/jetty-https.xml,etc/jetty-selector.xml"

echo Launching the openHAB runtime in debug mode...
java $debug_opts $prog_args -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Djetty.home.bundle=org.openhab.io.jetty -Dorg.osgi.service.http.port=$HTTP_PORT -Dorg.osgi.service.http.port.secure=$HTTPS_PORT -Dfelix.fileinstall.dir=addons -Djava.library.path=lib -Dequinox.ds.block_timeout=240000 -Dequinox.scr.waitTimeOnBlock=60000 -Dfelix.fileinstall.active.level=4 -Djava.awt.headless=true -jar $cp $* -console
java $debug_opts $prog_args \
-Dosgi.clean=true \
-Declipse.ignoreApp=true \
-Dosgi.noShutdown=true \
-Djetty.home.bundle=org.openhab.io.jetty \
-Dorg.osgi.service.http.port=$HTTP_PORT \
-Dorg.osgi.service.http.port.secure=$HTTPS_PORT \
-Dfelix.fileinstall.dir=addons \
-Djava.library.path=lib \
-Dequinox.ds.block_timeout=240000 \
-Dequinox.scr.waitTimeOnBlock=60000 \
-Dfelix.fileinstall.active.level=4 \
-Djava.awt.headless=true \
-jar $cp $* \
-console

0 comments on commit d0798b5

Please sign in to comment.