Crontab没有在linux中执行CURL命令

问题描述 投票:1回答:1

我创建了bash脚本并尝试手动执行它。然后它正常工作。之后我创建了crontab并将其设置为每5分钟执行一次。但它不起作用。

这是我的剧本

#!/bin/bash
curl --header "Content-Type: application/json" --request GET http://xxx.xxx.xx.x/api/refresh >> /var/www/my/log/cron/log
exit 0

创建此shell文件后,我使用了权限

chmod -x /etc/cron.my/refresh.sh

这是crontab的代码

*/5 * * * * /etc/cron.my/refresh.sh
bash curl cron chmod
1个回答
0
投票

您尚未向脚本授予执行权限,事实上,您已尝试将其删除。你应该写:chmod a+x /etc/cron.my/refresh.sh

此外,修改后重新启动cron服务。

© www.soinside.com 2019 - 2024. All rights reserved.