diff --git a/measure.py b/measure.py index 348363dbcc2c0ba4628acc1f0128e4b7acb4f548..d1cabe16a67b42a42b5c19e1e523397178bb7535 100644 --- a/measure.py +++ b/measure.py @@ -133,6 +133,7 @@ def loop(con1: serial.Serial, con2: serial.Serial): write_data() +@log_profile("main") def main() -> None: print("Starting") try: diff --git a/scripts/pull.bash b/scripts/pull.bash index a71199e7ea9ef58e1a6961cab654cddb6a36cd08..574a5d8a13505bceb68943d72589fdc4d9550684 100755 --- a/scripts/pull.bash +++ b/scripts/pull.bash @@ -1,15 +1,8 @@ #!/bin/bash -# wait until all other instances of the script are finished -while pidof -o %PPID -x "pull.bash">/dev/null; do - # check every 60 seconds - sleep 60 -done - cd `dirname "$0"`/.. echo -e "\n\n#####################################################################" echo $( date '+%F %H:%M:%S' ) | tee -a bash.log -git pull 2>&1 | tee -a bash.log echo "" | tee -a bash.log scripts/./push.bash 2>&1 | tee -a bash.log echo "" | tee -a bash.log \ No newline at end of file diff --git a/scripts/push.bash b/scripts/push.bash index 97757001b8845f77fd0229731fbd69550a5a749b..c882fdaaa1f1545decd2933686ac0d078caffe5f 100755 --- a/scripts/push.bash +++ b/scripts/push.bash @@ -1,19 +1,25 @@ #!/bin/bash -ls -la . -ls -la data -ls -la logs +# wait until all other instances of the script are finished +while pidof -x "python3 main.py">/dev/null; do + # check every 60 seconds + echo "python3 main.py is still running, checking in 60 seconds." + sleep 60 +done +sleep 10 + ps aux scripts/./write.bash -pip3 install multiprocessing_logging +sleep 10 + python3 measure.py -git add . -git commit -m "New data" && git push --force +sleep 10 + echo -e "Starting python script:\n" -loop_count = 1 +loop_count=1 while : ; do python3 main.py return_code=$? @@ -28,4 +34,8 @@ while : ; do echo -e "Ended with error, waiting and trying again" loop_count=$((loop_count + 1)) sleep $((loop_count * 60)) -done \ No newline at end of file +done + +git pull +git add . +git commit -m "New data" && git push --force \ No newline at end of file diff --git a/scripts/write.bash b/scripts/write.bash index 02facadd04b9a6dfdf6d3989ed6cd5f12fcfc29f..afda62836cd9a5b6846e17adf5ca06f4f4520c1d 100755 --- a/scripts/write.bash +++ b/scripts/write.bash @@ -17,6 +17,7 @@ then serial_dms=/dev/ttyACM1 else echo -e "\x1b[31mError: Something went wrong.\x1b[0m" + echo "$id" echo -e "Exiting" exit 1 fi