节点和crontab无法正常工作
我试图用crontab运行一个节点脚本,但不能按我的预期工作(Ubuntu 12.04)。 在我的crontab文件中
*/1 * * * * node /home/me/path/to/script.js > /home/me/path/to/output
这将产生空string输出,而不应该。
当我运行node /home/me/path/to/script.js > /home/me/path/to/output
,手动,一切都很好。
你能帮我解决吗?
将node
更改为来自which node
。 也就是说,把二进制执行进程的完整path。
*/1 * * * * /path/to/node /home/me/path/to/script.js > /home/me/path/to/output # ^^^^^^^^^^^^^
值通常是/usr/bin/node
。