replaced store binding with a database binding based on a berkeley db
[apps/agl-service-data-persistence.git] / ll-database-binding / conf.d / app-templates / template.d / start-on-target.sh.in
1 #!/bin/sh
2 #
3 # File:   start-on-target.sh
4 # Author: Fulup Ar Foll @ IoT.bzh
5 # Object: Forward signal (SIGTERM) to remote process
6 # Created on 24-May-2017, 09:23:37
7 # Usage: remote-target-populate update script under ./build directory
8
9 # Do not change manually use 'make remote-target-populate'
10 export RSYNC_TARGET=@RSYNC_TARGET@
11 export PROJECT_NAME=@PROJECT_NAME@
12 export RSYNC_PREFIX=@RSYNC_PREFIX@/@PROJECT_NAME@
13 export AFB_REMPORT=@AFB_REMPORT@
14 export AFB_TOKEN=@AFB_TOKEN@
15
16 exec ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -tt $RSYNC_TARGET << EOF
17     afb-daemon --workdir=$RSYNC_PREFIX --monitoring --port=$AFB_REMPORT --roothttp=./htdocs --ldpath=./lib --verbose --token=$AFB_TOKEN &
18     PID_DAEMON=\$!
19     trap "echo REMOTE-SIGNAL TRAP; kill -15 \$PID_DAEMON" INT QUIT TERM EXIT
20     echo "Target Process Waiting for command"
21
22     # wait for daemon to finish
23     wait \$PID_DAEMON
24     exit
25 EOF