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 norma
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.
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
that did the trick for me:
#!/bin/bash
export DISPLAY=:0
/usr/bin/phantomjs /home/pi/test.js