如何通过灯塔位置:cronexpression + AWS +蟒蛇 +灯塔
我已经创建了 AWS ec2 实例和一个 python 脚本来自动生成灯塔报告
我已经通过运行以下行在 AWS 服务器中成功手动运行了灯塔 python 代码 ubuntu@ip:~/Python_lighthouse$ python3 SEO_PYTHON_LIGHTHOUSE_lighthouse.py
但是,我正在努力通过 cronjob 运行相同的代码。
*/10 * * * * /usr/bin/python3 /home/ubuntu/Python_lighthouse/SEO_PYTHON_LIGHTHOUSE_lighthouse.py /home/ubuntu/Python_lighthouse/lighthouse.log 2>&1
(上面的 cronjob 工作正常但出现错误:/bin/ sh/:未找到灯塔)
以下版本和位置: 哪个 npm /home/ubuntu/.nvm/versions/node/v17.5.0/bin/npm 哪个节点 /home/ubuntu/.nvm/versions/node/v17.5.0/bin/node 哪个灯塔 /home/ubuntu/.nvm/versions/node/v17.5.0/bin/lighthouse
我尝试过像这样将 lighthouse 传递给我的 cronjob,但对我不起作用 */10 * * * * /home/ubuntu/.nvm/versions/node/v17.5.0/bin/lighthouse && /usr/bin/python3 /home/ubuntu/Python_lighthouse/SEO_PYTHON_LIGHTHOUSE_lighthouse.py /home/ubuntu/Python_lighthouse/lighthouse.log 2>&1
如果我做错了什么,请纠正我。提前致谢!!!!
I have created AWS ec2 instance and a python script to automate lighthouse reports
I have successfully ran the lighthouse python code in AWS server manually by running below lines
ubuntu@ip:~/Python_lighthouse$ python3 SEO_PYTHON_LIGHTHOUSE_lighthouse.py
However, I am struggling to run the same code via cronjob.
*/10 * * * * /usr/bin/python3 /home/ubuntu/Python_lighthouse/SEO_PYTHON_LIGHTHOUSE_lighthouse.py /home/ubuntu/Python_lighthouse/lighthouse.log 2>&1
(above cronjob working fine but getting error: /bin/sh/: lighthouse not found)
Following version and locations:
which npm
/home/ubuntu/.nvm/versions/node/v17.5.0/bin/npm
which node
/home/ubuntu/.nvm/versions/node/v17.5.0/bin/node
which lighthouse
/home/ubuntu/.nvm/versions/node/v17.5.0/bin/lighthouse
I have tried passing lighthouse to my cronjob like this but didn't work for me
*/10 * * * * /home/ubuntu/.nvm/versions/node/v17.5.0/bin/lighthouse && /usr/bin/python3 /home/ubuntu/Python_lighthouse/SEO_PYTHON_LIGHTHOUSE_lighthouse.py /home/ubuntu/Python_lighthouse/lighthouse.log 2>&1
please correct me if I am doing something wrong. Thanks in advance!!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论