Starting Phantomjs From A Script In A Cronjob
I'm running a python script through a cronjob. I have a virtual environment and in the cronjob I'm running it through this virtual environment. When I run the script normally phant
Solution 1:
As phantom is probably installed in /usr/local/bin
, you should add that dir to PATH
in your crontab. The following should do the trick:
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
Solution 2:
As an alternative to accepted answer, you can add the following line at the 1st line of crontab:
PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs
which specifies the path of PhantomJS before running cron tasks.
Solution 3:
that did the trick for me:
#!/bin/bashexport DISPLAY=:0
/usr/bin/phantomjs /home/pi/test.js
Post a Comment for "Starting Phantomjs From A Script In A Cronjob"