Switch start scripts to use bash, clean up

This commit is contained in:
Satu Koskinen 2022-10-11 09:19:01 +03:00
parent 163e75cccc
commit ef5c7d03cc
4 changed files with 19 additions and 24 deletions

View File

@ -1,15 +1,19 @@
#!/bin/sh #!/bin/bash
# Print all commands to standard output
set -x
SCRIPT_PATH=/home/pi/hydrophonitor/scripts
# Export the configuration values # Export the configuration values
. /home/pi/hydrophonitor/scripts/export-config-values.sh $SCRIPT_PATH/export-config-values.sh
# Create output directory # Create output directory
OUTPUT_DIR=$BASE_DIR_PATH/$(date +"%Y-%m-%d_%H-%M-%S_output") OUTPUT_DIR=$BASE_DIR_PATH/$(date +"%Y-%m-%d_%H-%M-%S_output")
mkdir -p $OUTPUT_DIR/audio echo "Create output directory $OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR"/audio
# Sleep for a little to wait for GPS and sound card to be ready # Sleep for a little to wait for GPS and sound card to be ready
sleep 10 sleep 10
echo "(export OUTPUT_DIR=$OUTPUT_DIR; /home/pi/hydrophonitor/scripts/start-audio.sh & /home/pi/hydrophonitor/scripts/start-gps.sh)" >> $OUTPUT_DIR/log.txt 2>&1 (export OUTPUT_DIR=$OUTPUT_DIR; $SCRIPT_PATH/start-audio.sh & $SCRIPT_PATH/start-gps.sh & $SCRIPT_PATH/start-pressure-depth.sh) >> "$OUTPUT_DIR"/log.txt 2>&1
(export OUTPUT_DIR=$OUTPUT_DIR; /home/pi/hydrophonitor/scripts/start-audio.sh & /home/pi/hydrophonitor/scripts/start-gps.sh) >> $OUTPUT_DIR/log.txt 2>&1

View File

@ -1,9 +1,8 @@
#!/bin/sh #!/bin/bash
# Export the configuration values # Export the configuration values
. /home/pi/hydrophonitor/scripts/export-config-values.sh /home/pi/hydrophonitor/scripts/export-config-values.sh
AUDIO_TARGET_PATH="/home/pi/hydrophonitor/audio-logger/target/release"
AUDIO_TARGET_EXECUTABLE="audio" AUDIO_TARGET_EXECUTABLE="audio"
OPTIONS="rec \ OPTIONS="rec \
@ -15,6 +14,4 @@ OPTIONS="rec \
--buffer-size 1024 \ --buffer-size 1024 \
alsa" alsa"
echo "cd $AUDIO_TARGET_PATH && ./$AUDIO_TARGET_EXECUTABLE $OPTIONS" cd /home/pi/hydrophonitor/audio-logger/target/release && ./$AUDIO_TARGET_EXECUTABLE $OPTIONS
cd $AUDIO_TARGET_PATH && ./$AUDIO_TARGET_EXECUTABLE $OPTIONS

View File

@ -1,12 +1,8 @@
#!/usr/bin/sh #!/bin/bash
# Export the configuration values # Export the configuration values
. /home/pi/hydrophonitor/scripts/export-config-values.sh /home/pi/hydrophonitor/scripts/export-config-values.sh
GPS_EXECUTABLE_PATH="/home/pi/hydrophonitor/gps-logger"
OPTIONS="--output $OUTPUT_DIR --interval $GPS_INTERVAL" OPTIONS="--output $OUTPUT_DIR --interval $GPS_INTERVAL"
echo "cd $GPS_EXECUTABLE_PATH && python record-gps.py $OPTIONS" cd /home/pi/hydrophonitor/gps-logger && python record-gps.py $OPTIONS
cd $GPS_EXECUTABLE_PATH && python record-gps.py $OPTIONS

View File

@ -1,10 +1,8 @@
#!/usr/bin/sh #!/bin/bash
# Export the configuration values # Export the configuration values
. /home/pi/hydrophonitor/scripts/export-config-values.sh /home/pi/hydrophonitor/scripts/export-config-values.sh
DEPTH_EXECUTABLE_PATH="/home/pi/hydrophonitor/depth-logger"
OPTIONS="--output $OUTPUT_DIR --interval $DEPTH_INTERVAL" OPTIONS="--output $OUTPUT_DIR --interval $DEPTH_INTERVAL"
cd $DEPTH_EXECUTABLE_PATH && python record-depth.py $OPTIONS cd /home/pi/hydrophonitor/depth-logger && python record-depth.py $OPTIONS