|
|
|
|
@ -65,7 +65,6 @@ run_script() { |
|
|
|
|
else |
|
|
|
|
log "$script failed with exit code $exit_code" |
|
|
|
|
fi |
|
|
|
|
# Extract sleep time from the last line containing "sleep_time:" |
|
|
|
|
sleep_time=$(grep "sleep_time:" "$script_log" | tail -n 1 | grep -oP 'sleep_time: \K[0-9]+' || echo $((RANDOM % 601 + 1200))) |
|
|
|
|
log "$script completed, sleep_time: $sleep_time seconds" |
|
|
|
|
rm -f "$LOCK_DIR/${script_name}.lock" |
|
|
|
|
@ -160,7 +159,7 @@ if [ "$1" == "start" ]; then |
|
|
|
|
fi |
|
|
|
|
for script in foodie_automator_rss.py foodie_automator_reddit.py foodie_automator_google.py; do |
|
|
|
|
if [ -f "$script" ]; then |
|
|
|
|
sleep_time=$(run_script "$script") |
|
|
|
|
sleep_time=$(run_script "$script" | tail -n 1) |
|
|
|
|
if [ -n "$sleep_time" ]; then |
|
|
|
|
log "Sleeping for $sleep_time seconds after $script" |
|
|
|
|
sleep "$sleep_time" |
|
|
|
|
@ -215,7 +214,7 @@ else |
|
|
|
|
fi |
|
|
|
|
for script in foodie_automator_rss.py foodie_automator_reddit.py foodie_automator_google.py; do |
|
|
|
|
if [ -f "$script" ]; then |
|
|
|
|
sleep_time=$(run_script "$script") |
|
|
|
|
sleep_time=$(run_script "$script" | tail -n 1) |
|
|
|
|
if [ -n "$sleep_time" ]; then |
|
|
|
|
log "Sleeping for $sleep_time seconds after $script" |
|
|
|
|
sleep "$sleep_time" |
|
|
|
|
|