John Dene
John Dene

Reputation: 570

How to setup a cron job for my scrapy crawlers using python-crontab or crontab -e

I am totally new to the cron jobs. Want to setup cronjobs.

Approach I used are not working

crontab -e

2 * * * * /home/user/Desktop/folder/scrapy crawl xyz

I want to see if its working every 2 minutes but didn't get any output.

I just want a simple step by step process to setup cronjobs.

Upvotes: 1

Views: 1614

Answers (2)

Ben Beirut
Ben Beirut

Reputation: 763

Make your script runnable.

chmod +x /home/user/Desktop/folder/scrapy

And add :

#!/usr/bin/env/ python

to your script.

Your crontab is correct and cron will run the script with the given parameters every 2 minutes.

Upvotes: 1

ikoverdyaev
ikoverdyaev

Reputation: 821

Try to add PATH to your cron:

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

or #!/usr/bin/python to top of script

Upvotes: 3

Related Questions