-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathrun
executable file
·78 lines (58 loc) · 1.84 KB
/
run
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
#
#!/bin/bash
# Do not Change this line directly.
# Please use the command ./set_pluto to configure the Pluto IP address if required.
# This will ensure that all necessary files are updated, including this one.
export PLUTO_IP=pluto.local
if test -e /tmp/langstoneTx ;then
rm /tmp/langstoneTx
fi
mkfifo /tmp/langstoneTx
if test -e /tmp/langstoneRx ;then
rm /tmp/langstoneRx
fi
mkfifo /tmp/langstoneRx
if !(ps -ax |grep -v grep| grep -q Lang_TX.py) then
sudo amixer -c1 cset numid=6 100% > /dev/null 2>&1
sudo amixer -c1 cset numid=8 50% > /dev/null 2>&1
sudo cp /home/pi/Langstone/splashload.bgra /dev/fb0
sudo raspi-gpio set 17,18 pu
retry=0
until [ ${retry} -ge 4 ]
do
(ping -c1 $PLUTO_IP 2>/dev/null |grep -q received) && break
retry=$[${retry}+1]
sleep 1
done
#Check if Pluto failed to respond
if [ ${retry} -ge 4 ]; then
clear
sudo cp /home/pi/Langstone/plutofail.bgra /dev/fb0
sleep 5
exit 1
fi
# Check if Pluto was rebooting and was slow to respond
if [ ${retry} -ge 1 ]; then
sleep 5
fi
#start up the GNU Radio flowgraphs
python /home/pi/Langstone/Lang_TX.py > /tmp/LangstoneTX.log 2>&1 &
sleep 3
python /home/pi/Langstone/Lang_RX.py > /tmp/LangstoneRX.log 2>&1 &
sleep 3
#check that the GNU modules started corretly
if (ps -ax | grep -v grep| grep -q Lang_TX.py)then
# If they did then start the GUI
/home/pi/Langstone/GUI > /tmp/LangstoneGUI.log 2>&1
else
# If not then display the error screen
sudo cp /home/pi/Langstone/gnufail.bgra /dev/fb0
sleep 10
fi
# Send a reboot command to Pluto after GUI Exits
ssh-keygen -f "/home/pi/.ssh/known_hosts" -R $PLUTO_IP >/dev/null 2>&1
timeout 2 sshpass -p analog ssh -o StrictHostKeyChecking=no root@$PLUTO_IP 'PATH=/bin:/sbin:/usr/bin;reboot' >/dev/null 2>&1
else
echo Langstone is already running. Use ./stop first.
sleep 5
fi