diff --git a/cycle.sh b/cycle.sh new file mode 100644 index 0000000..67a7373 --- /dev/null +++ b/cycle.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Function to run the command +run_command() { + python manage.py ingester & + PID=$! + echo "Started process with PID: $PID" +} + +# Function to terminate the command +interrupt_command() { + kill -SIGINT $PID + echo "Interrupted process with PID: $PID" +} + +# Run the command initially +run_command + +# Loop to restart the command every 2 hours until ingester_done.flag is found +while [ ! -f ingester_done.flag ]; do + # Wait for 2 hours (7200 seconds) + sleep 7200 + + # Terminate the command + interrupt_command + + # Restart the command + run_command +done + +echo "ingester_done.flag found. Exiting script."