summaryrefslogtreecommitdiff
path: root/src/appMain/core.sh
blob: 4d3fbfce1ed59636e81b11a6e7cfa49b60a44c8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
cd $(dirname $0)
DIR=$(pwd)
PID_FILE=$DIR/core.pid

function core_start() {
  echo "Starting SmartDeviceLinkCore"
  LD_LIBRARY_PATH=$DIR ${DIR}/smartDeviceLinkCore &
  PID=$!
  echo $PID > $PID_FILE
}

function core_stop() {
  echo "Stopping SmartDeviceLinkCore"
  kill $(cat $PID_FILE)
  rm $PID_FILE
}

if [ x$1 == xstop ]; then
  core_stop
elif [ x$1 == xrestart ]; then
  core_stop
  core_start
elif [ x$1 == xstart ]; then
  core_start
else
  echo "usage: core.sh [start/restart/stop]"
fi