This command works
az containerapp exec --name weather-scrapy-shell --resource-group rg-SportsAzureFunctionsContainer --container weather-scrapy-shell --command "/bin/sh"
This command connects me to the container and I can manually run
cd /app/Scrapy/Scrapy
then
scrapy crawl WeatherData -a Week=week -a Year=2023 -a Day=135
That works.
I am trying to automate this process so I need to connect to the shell and also run the 2 commands listed above so this task can be automated and scripted.
Is there a way to initiate a container and with one command execute all 3 commands in the shell at once?
az containerapp exec --name weather-scrapy-shell --resource-group rg-SportsAzureFunctionsContainer --container weather-scrapy-shell --command "/bin/sh -c 'cd /app/Scrapy/Scrapy && scrapy crawl WeatherData -a Week=week -a Year=2023 -a Day=135'"
here is the command output
INFO: Successfully connected to container: 'weather-scrapy-shell'. [ Revision: 'weather-scrapy-shell--naa89wx', Replica: 'weather-scrapy-shell--naa89wx-5cf5697597-4lnmx']
/app/Scrapy/Scrapy: 1: Syntax error: Unterminated quoted string
INFO: received success status from cluster
The error states there is a missing quote but I have tried this variation and got same error
az containerapp exec --name nflweather-scrapy-shell --resource-group rg-SportsAzureFunctionsContainer --container weather-scrapy-shell --command "/bin/sh -c 'cd /app/Scrapy/Scrapy' && 'scrapy crawl WeatherData -a Week=week -a Year=2023 -a Day=135'"
This variation does not fail. Output says it was successful but it does not execute the script and does not generate any data.
az containerapp exec --name weather-scrapy-shell --resource-group rg-SportsAzureFunctionsContainer --container weather-scrapy-shell --command "/bin/sh -c cd /app/Scrapy/Scrapy && scrapy crawl WeatherData -a Week=week -a Year=2023 -a Day=135"
My Objective is to be able to to connect and run all 3 commands. IS there another way if this apporach is incorrect?