I have created an application in casperjs which scraps sport data from a website.
I would like to run this application per cronjob on heroku, to save the sports results in a csv, database or external google docs(haven`t decided yet).
However, I have one questions before I start to implement it for heroku:
heroku
, which claims that it can run casperjs
scirpts. However, do I need nodejs
to run the script scheduled? Or can I just create a cronjob on heroku?I really appreciate your replies!
You most definitely can run your script as a Cron job on heroku.
Step 1 - Create the app using the buildpack mentioned :
heroku apps:create myapp --stack cedar --buildpack http://github.com/misza222/heroku-buildpack-casperjs.git
Step 2 - Add scheduler and log addons :
heroku addons:add logentries
heroku addons:add scheduler
Step 3 - open the scheduler :
heroku addons:open scheduler
or use the dashboard, click My Apps > General Info > Addons > Scheduler
Step 4 - Setup your cronjob :
./vendor/casperjs/bin/casperjs myCasperScript.js
and choose the frequency you want your script to run at.
Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With