使用 phantomjs 设置 cron 作业
Set cronjob using phantom js
我已经使用 phantom js 创建了一个小应用程序。但是,它在我的本地 (Windows) 中运行良好。
当我将源代码上传到 cpanel 中的实时 (linux) 服务器时,我想使用 cronjob 每分钟 运行 我的 js 文件。我如何在服务器中设置所有内容。
我有如下上传源。
- Phantom js 源码 linux /home/my_user/phantom/bin/phantomjs
中的 phantom 源码
- 我的js文件在/home/my_user/phantom/bin/test.js
我尝试像
那样设置 cron
PHANTOMJS_EXECUTABLE=/home/my_user/public_html/phantom/bin/phantomjs -q /home/my_user/public_html/phantom/bin/test.js
但这不起作用。让我知道我的命令或其他地方缺少什么。这与其他 PHP cron 不同,因为我需要在 js 文件中 运行 phantomjs 应用程序并且我想 运行 使用 cron 的 js 文件。
为了 运行 每分钟一个脚本,我建议创建一个类似的 cron 作业:
* * * * * /home/my_user/public_html/phantom/bin/phantomjs /home/my_user/public_html/phantom/bin/test.js
我已经使用 phantom js 创建了一个小应用程序。但是,它在我的本地 (Windows) 中运行良好。 当我将源代码上传到 cpanel 中的实时 (linux) 服务器时,我想使用 cronjob 每分钟 运行 我的 js 文件。我如何在服务器中设置所有内容。 我有如下上传源。
- Phantom js 源码 linux /home/my_user/phantom/bin/phantomjs 中的 phantom 源码
- 我的js文件在/home/my_user/phantom/bin/test.js
我尝试像
那样设置 cronPHANTOMJS_EXECUTABLE=/home/my_user/public_html/phantom/bin/phantomjs -q /home/my_user/public_html/phantom/bin/test.js
但这不起作用。让我知道我的命令或其他地方缺少什么。这与其他 PHP cron 不同,因为我需要在 js 文件中 运行 phantomjs 应用程序并且我想 运行 使用 cron 的 js 文件。
为了 运行 每分钟一个脚本,我建议创建一个类似的 cron 作业:
* * * * * /home/my_user/public_html/phantom/bin/phantomjs /home/my_user/public_html/phantom/bin/test.js