-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStartAdmin.sh
executable file
·86 lines (69 loc) · 1.63 KB
/
StartAdmin.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
#// Copyright (c) 2023 ZKM | Hertz-Lab (http://www.zkm.de)
#// Bernd Lintermann <bernd.lintermann@zkm.de>
#//
#// BSD Simplified License.
#// For information on usage and redistribution, and for a DISCLAIMER OF ALL
#// WARRANTIES, see the file, "LICENSE" in this distribution.
#//
loop="+loop"
DIR="$(realpath -s $(dirname $0))"
cd $DIR
source config.txt
if [ "$adminPort" != "" ] ; then
adminPortParam="+adminport $adminPort"
fi
if [ "$webPort" != "" ] ; then
webPortParam="+webport $webPort"
fi
if [ "$hubPort" != "" ] ; then
hubPortParam="+hubport $((webPort+1))"
fi
if [ "$configPort" != "" ] ; then
configPortParam="+configport $configPort"
fi
if [ "$configServer" == "true" ]; then
configServerParam="+configServer"
fi
if [ "$dataDir" != "" ] ; then
fileSystem="+fileSystem $dataDir"
fi
if [ -f SpaceFailureReportScript.sh ] ; then
spaceFailParam="+spaceFailureReportScript SpaceFailureReportScript.sh"
fi
ARGS=( "$@" )
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
+loop)
loop="$1"
shift # past argument
;;
-loop)
shift # past argument
;;
+v)
verbose="+v"
shift # past argument
;;
restart)
pids=$(pgrep -xa $EXECUTABLE|grep "+conf $conf")
[ -z "$pids" ] || (kill -9 $pids ; sleep 3)
shift # past argument
;;
*)
ARGS+=( "$1" )
shift # past argument
;;
esac
done
pids=$(pgrep -xa lidarAdmin|grep "+conf $conf")
if [ "$pids" != "" ] ; then
exit 0
fi
cmd="./lidarAdmin.sh $verbose +conf $conf $configServerParam $configPortParam $adminPortParam $webPortParam $hubPortParam ${ARGS[@]} $fileSystem $spaceFailParam $loop"
if [ "$verbose" != "" ] ; then
echo $cmd
fi
$cmd