|
|
|
|
@ -45,6 +45,7 @@ run_script() { |
|
|
|
|
local script_name="${script%.py}" |
|
|
|
|
local script_log="$LOG_DIR/${script_name}.log" |
|
|
|
|
if check_running "$script_name"; then |
|
|
|
|
echo "0" # Skip sleep |
|
|
|
|
return 1 |
|
|
|
|
fi |
|
|
|
|
log "Running $script..." |
|
|
|
|
@ -66,8 +67,8 @@ run_script() { |
|
|
|
|
|
|
|
|
|
stop_scripts() { |
|
|
|
|
log "Stopping scripts..." |
|
|
|
|
for script in foodie_automator_*.py foodie_engagement_tweet.py; do |
|
|
|
|
if [ -f "$script" ] && [ "$script" != "foodie_weekly_thread.py" ]; then |
|
|
|
|
for script in foodie_automator_rss.py foodie_automator_reddit.py foodie_automator_google.py; do |
|
|
|
|
if [ -f "$script" ]; then |
|
|
|
|
local script_name="${script%.py}" |
|
|
|
|
if pkill -TERM -f "$VENV_PYTHON.*$script_name"; then |
|
|
|
|
log "Sent TERM to $script_name" |
|
|
|
|
@ -128,10 +129,10 @@ if [ "$1" == "start" ]; then |
|
|
|
|
log "Error: .env file not found" |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
for script in foodie_automator_rss.py foodie_automator_reddit.py foodie_automator_google.py foodie_engagement_tweet.py; do |
|
|
|
|
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" | tail -n 1) |
|
|
|
|
if [ -n "$sleep_time" ]; then |
|
|
|
|
if [ "$sleep_time" != "0" ]; then |
|
|
|
|
log "Sleeping for $sleep_time seconds after $script" |
|
|
|
|
sleep "$sleep_time" |
|
|
|
|
fi |
|
|
|
|
@ -179,10 +180,10 @@ else |
|
|
|
|
log "Error: .env file not found" |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
for script in foodie_automator_rss.py foodie_automator_reddit.py foodie_automator_google.py foodie_engagement_tweet.py; do |
|
|
|
|
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" | tail -n 1) |
|
|
|
|
if [ -n "$sleep_time" ]; then |
|
|
|
|
if [ "$sleep_time" != "0" ]; then |
|
|
|
|
log "Sleeping for $sleep_time seconds after $script" |
|
|
|
|
sleep "$sleep_time" |
|
|
|
|
fi |
|
|
|
|
|