1#!/bin/sh -eu
2
3# Download Leshan if needed
4if [ ! -f leshan-server-demo.jar ]; then
5        wget https://ci.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-server-demo.jar
6fi
7
8if [ ! -f leshan-bsserver-demo.jar ]; then
9	wget 'https://ci.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-bsserver-demo.jar'
10fi
11
12mkdir -p log
13
14start-stop-daemon --make-pidfile --pidfile log/leshan.pid --chdir $(pwd) --background --start \
15        --startas /bin/bash -- -c "exec java -jar ./leshan-server-demo.jar -wp 8080 -vv --models-folder objects >log/leshan.log 2>&1"
16
17start-stop-daemon --make-pidfile --pidfile log/leshan_bs.pid --chdir $(pwd) --background --start \
18        --startas /bin/bash -- -c "exec java -jar ./leshan-bsserver-demo.jar -lp=5783 -slp=5784 -wp 8081 -vv >log/leshan_bs.log 2>&1"
19