-
Notifications
You must be signed in to change notification settings - Fork 199
Run on Synology NAS
BWS Systems edited this page Jul 30, 2019
·
1 revision
- Install Java on NAS from package centre app
- Put jar file onto NAS in a folder of your choice
- Run JAR file from terminal using command line: nohup java -jar ha-bridge.jar &
- Make sure your in the folder with the ha-bridge.jar file when running the command as you may think you are but type dir to check as you may be in a folder with the same name that is virtual.
#!/bin/sh
PATH=$PATH:/var/packages/Java8/target/j2sdk-image/bin:/var/packages/Java8/target/j2sdk-image/jre/bin
BASEPATH=$(dirname $0)
mkdir -p $BASEPATH/data
JARFILE="ha-bridge.jar"
LOGFILE="$BASEPATH/${JARFILE}.log"
JAVA="ava8"
PIDFILE="/var/run/ha-bridge.pid"
cd $BASEPATH
start(){
if [ "$JAVA" != "$(which java|grep -oP $JAVA)" ]; then
echo "Java8 not found - please install first"
exit 1
fi
if [ -f $JARFILE ]; then
java -jar $JARFILE &> $LOGFILE &
echo $! > $PIDFILE
else
echo "HA Bridge JAR file not found. Download from https://github.com/bwssytems/ha-bridge/releases"
echo "Rename or link it to '$JARFILE'"
exit 1
fi
}
stop(){
kill $(cat $PIDFILE)
}
case $1 in
start)
start
;;
stop)
stop
;;
*)
echo "usage: $0 {start|stop}"
;;
esac