Running casperjs for a cronjob on a hero

I created an application in casperjs that breaks sports data from a website.

I would like to run this application on cronjob on heroku in order to save the results of sports events in csv, a database or external Google documents (I have not decided yet).

However, I have one question before I start implementing it for heroku:

  • I found this buildpack for heroku that claims it can run casperjs scirpts. However, do I need nodejs to run the scheduled script? Or can I just create a cronjob on heroku?

I really appreciate your answers!

+5
source share
1 answer

You can definitely run your script as a Cron job on heroku.

Step 1 - Build the application using the mentioned buildpack:

 heroku apps:create myapp --stack cedar --buildpack http://github.com/misza222/heroku-buildpack-casperjs.git 

Step 2 - add the scheduler and log add-ons:

 heroku addons:add logentries heroku addons:add scheduler 

Step 3 - open the scheduler:

 heroku addons:open scheduler 

or use the toolbar, click "My Applications"> "General Information"> "Addons"> "Scheduler"

Step 4 - Install your cronjob:

 ./vendor/casperjs/bin/casperjs myCasperScript.js 

and select the frequency you want to run the script.

Hope this helps!

+4
source

Source: https://habr.com/ru/post/1203545/


All Articles