So, I'm trying to run casperJS as a cron job on my server, this is the crontab:
* * * * * /usr/local/bin/casperjs /var/www/javascript/uat/prime.sh 2>&1
This is prime.sh
#!/bin/bash
export PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs
/usr/local/bin/casperjs /var/www/javascript/uat/prime.js 2>&1
I've also added the export to the users' .bash_profile, but cron emails me with
Fatal: [Errno 2] No such file or directory; did you install phantomjs?
Not sure what else to do! Any advice?
Calling a .sh
with casperjs which only runs .js
or .coffee
files won't fork for sure. I think you can setup your cronjob more directly like this:
* * * * * PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs /usr/local/bin/casperjs /var/www/javascript/uat/prime.js 2>&1
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