forked from commaai/panda
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmarsmode-active.sh
executable file
·47 lines (44 loc) · 1.12 KB
/
marsmode-active.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
#!/bin/bash
BIND=`dirname $0`
LINK=$BIND/marsmode-active.link
MYPY=$BIND/../../bin/python3
if [ ! -x $MYPY ]
then
MYPY=`which python3`
fi
if [ "q$1" == "q-h" ]
then
echo "Usage: $0 to start mars mode script in a loop"
echo "Usage: $0 <script> to set <script> as active script"
elif [ "q$1" == "q" ]
then
if [ -f $LINK ]
then
echo "running startup script"
script=$LINK
else
echo "running default startup script"
script=$BIND/marsmode-mediavolume-basic.py
fi
while true
do
echo "starting up"
$MYPY $script
echo "sleeping before restart"
sleep 3
done
else
script=$1
if [ -f "$script" ]
then
if [ -f $LINK ]
then
echo "removing stale startup link"
rm $LINK
fi
echo "creating startup link"
ln -s $script $LINK
else
echo "Not found: $script"
fi
fi