Add run.sh
This commit is contained in:
		
							
								
								
									
										26
									
								
								run.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								run.sh
									
									
									
									
									
										Normal 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
 | 
			
		||||
		Reference in New Issue
	
	Block a user