-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·57 lines (42 loc) · 898 Bytes
/
start.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
#!/bin/bash
mkdir -p ./logs
# user=`echo $USER`
# if [ "$user" != "root" ]; then
# echo "Script must be run as root. Try 'sudo ./start.sh'"
# exit 1
# fi
sleep=2
to_start=(
"central_hub"
"battery"
"behavior"
"compass"
"hazards"
"motor_control"
"onboard_ui"
"system_stats"
"web_server"
## video feed and recognition via Pi4 camera
"vision"
## depth_map via Intel Realsense camera
"vision_realsense"
)
if [ $# -ne 0 ]; then
to_start=($@)
sleep=0
fi
for sub_system in ${to_start[@]}
do
echo "starting $sub_system"
logfile="./logs/$sub_system.log"
if [ -f "$logfile" ]; then
mv -f "$logfile" "$logfile".1
fi
echo "starting $sub_system at $(date)" >> "$logfile"
python3 src/start_$sub_system.py > $logfile 2>&1 &
echo $! > ./$sub_system.pid
if [[ $sleep > 0 ]]; then
echo "sleeping for $sleep seconds"
sleep $sleep
fi
done