-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstart.sh
executable file
·23 lines (20 loc) · 1022 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
#!/bin/bash
# Check how many images are present
NUM_FILES_IN_IMAGES=$(ls -1q /home/tjuav-pi/FlightSoftware/assets/images | wc -l)
# If any images were saved, then save them and re-generate directory
if [ $NUM_FILES_IN_IMAGES -gt 1 ]
then
mv /home/tjuav-pi/FlightSoftware/assets/images/sample.png /home/tjuav-pi/FlightSoftware/assets/sample.png
mv /home/tjuav-pi/FlightSoftware/assets/images "/home/tjuav-pi/FlightSoftware/$(date +%F-%T)"
mkdir /home/tjuav-pi/FlightSoftware/assets/images
mv /home/tjuav-pi/FlightSoftware/assets/sample.png /home/tjuav-pi/FlightSoftware/assets/images/sample.png
fi
# If image data exists, save it
if test -f "/home/tjuav-pi/FlightSoftware/image_data.json"
then
mv /home/tjuav-pi/FlightSoftware/image_data.json "/home/tjuav-pi/FlightSoftware/image_data_restart_$(date +%F-%T).json"
touch image_data.json
fi
# Activate virtual environment and run FlightSoftware
source /home/tjuav-pi/FlightSoftware/venv/bin/activate
python -u /home/tjuav-pi/FlightSoftware/main.py