diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..7102ce0 --- /dev/null +++ b/run.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# If SITE environment variable is not provided, set a default value +if [ -z "$SITE" ]; then + SITE="meo.pt" +fi + +# Split the SITE environment variable into an array of site names +IFS=',' read -ra SITES <<< "$SITE" + +# Run the server in the background +npm run serve & + +# Sleep for a while to let the server start before grabbing the data +sleep 5 + +while true; do + # Run the grab command for each site in the array + for site in "${SITES[@]}"; do + cd /app/epg && git pull origin master && cd - + SITE="$site" npm run grab + done + + # Sleep for a duration (e.g., 12 hours) before repeating the process + sleep "$I" +done