I'm trying to schedule a cron job involving a bash script which invokes a scrapy crawl command. For one of the scrapy arguments, I have an argument called query
which is the datetime I wish to start crawling.
This is the scrapy command:
scrapy crawl TweetScraper -a query=$QUERY
The only important thing to note is that I'm trying to set the query
argument to a variable defined by a Query variable defined before it.
And here is the complete code:
#!/bin/bash
QUERY=$(printf "#DeepLearning since: %(%Y-%m-%dT%H:%M:%S)T" $(($(printf "%(%s)T") - 1 * 60)))
echo $QUERY
scrapy crawl TweetScraper -a query=$QUERY
The query was based off of subtract 1 hour from date in unix shell script.
Ideally I would like to make the argument set to one hour before the current time. Is this kind of construction possible? Currently I am getting an error because scrapy is interpreting the query as two different variables.