mirror of
https://github.com/eduardogsilva/routerfleet.git
synced 2025-08-31 15:31:29 +02:00
Script for running cron tasks during development only.
This commit is contained in:
parent
c7f1dd2e9e
commit
e228cb3667
1 changed files with 26 additions and 0 deletions
26
containers/cron/run_dev_cron.sh
Executable file
26
containers/cron/run_dev_cron.sh
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# This script is intended only for development purposes.
|
||||||
|
# It reads the cron file and executes the curl commands in it.
|
||||||
|
CRON_FILE="cron_tasks"
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
start_time=$(date +%s)
|
||||||
|
|
||||||
|
# Read the cron file and extract curl commands
|
||||||
|
grep -o 'curl[^>]*' $CRON_FILE | while read -r line; do
|
||||||
|
echo "Executing: $line"
|
||||||
|
eval "$line"
|
||||||
|
echo ""
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
||||||
|
elapsed_time=$(( $(date +%s) - start_time ))
|
||||||
|
|
||||||
|
if [ $elapsed_time -lt 60 ]; then
|
||||||
|
sleep_time=$(( 60 - elapsed_time ))
|
||||||
|
echo "Waiting $sleep_time seconds to complete the cycle."
|
||||||
|
sleep $sleep_time
|
||||||
|
else
|
||||||
|
echo "Cycle took more than 60 seconds. Resuming immediately."
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Add table
Add a link
Reference in a new issue