Add run.sh

This commit is contained in:
Sthope 2023-08-23 02:10:13 +02:00
parent d4c307a751
commit a76cb25761

26
run.sh Normal file
View File

@ -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