Starting phantomJS from a script in a cronjob

我只是一个虾纸丫 提交于 2019-11-29 06:50:24

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

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.

that did the trick for me:

#!/bin/bash
export DISPLAY=:0
/usr/bin/phantomjs /home/pi/test.js
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!