From 4b3e1e98575f088a8fc592da6b8b0dae35b93d27 Mon Sep 17 00:00:00 2001 From: vyomakesh09 Date: Sun, 3 Mar 2024 18:48:58 +0000 Subject: [PATCH] add examples and run cron job --- run_examples.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 run_examples.sh diff --git a/run_examples.sh b/run_examples.sh new file mode 100644 index 00000000..e41c7e1f --- /dev/null +++ b/run_examples.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Define a file to keep track of successfully executed scripts +SUCCESS_LOG="successful_runs.log" + +for f in examples/example_*.py; do + # Check if the script has been logged as successful + if grep -Fxq "$f" "$SUCCESS_LOG"; then + echo "Skipping ${f} as it ran successfully in a previous run." + else + # Run the script if not previously successful + if /home/kye/miniconda3/envs/swarms/bin/python "$f" 2>>errors.txt; then + echo "(${f}) ran successfully without errors." + # Log the successful script execution + echo "$f" >> "$SUCCESS_LOG" + else + echo "Error encountered in ${f}. Check errors.txt for details." + break + fi + fi + echo "##############################################################################" +done