在 linux:with crontab: 我用 as 进行测试:
* * * * */bin/echo "xin chao">>/home/iloveyou/text.txt
。效果很好。
但是当我测试运行一个网址时:
*/3 * * * * /usr/bin/curl -k https://192.169.30.126/joomlandk2/index.php/exportmanager
它不起作用。当我从终端窗口运行: /usr/bin/curl -k https://192.169.30.126/joomlandk2/index.php/exportmanager
时。运行正常。
为什么?我想使用 crontab 设置运行 https://192.169.30.126/joomlandk2/index.php/exportmanager
。你能帮助我吗?谢谢。
最佳答案
根据 OP 请求,此答案详细说明了如何在 crond 上下文中逐步复制用户环境。
在 crontab 中,调用 shell 脚本。
*/3 * * * * /home/userX/dir/exportmanager.sh
在 shell 中,在调用curl 之前回显或/并设置环境,以获得与您自己的环境类似的条件。
Https 使用 SSL key ,curl 如何查找该 key ,在哪个证书存储库中?
请参阅--capath
选项。
#!/bin/bash
set VAR=value
/usr/bin/curl -k https://192.169.30.126/joomlandk2/index.php/exportmanager\
>/home/userX/dir/exportmanager.log
关于cron - 为什么 crontab 不工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13159157/