lora_sync/run_script.sh

27 lines
506 B
Bash
Raw Normal View History

2024-06-13 14:09:22 -07:00
#!/bin/bash
# Set the maximum number of retries
max_retries=5
retries=0
while [ $retries -lt $max_retries ]; do
# Run your Python script
python main.py
# Check the exit code of the Python script
if [ $? -ne 0 ]; then
echo "Error occurred. Retrying..."
retries=$((retries + 1))
else
echo "Script executed successfully."
retries=0
break
fi
done
if [ $retries -eq $max_retries ]; then
echo "Max retries reached. Exiting."
exit 1
fi