linux 中的 Crontab 未执行 CURL 命令
Crontab not executing CURL command in linux
我创建了 bash 脚本并尝试执行它 manually.then 它工作正常。
之后我创建了 crontab 并将其设置为每 5 次执行一次 minutes.but 它不工作。
这是我的脚本
#!/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
您没有授予该脚本执行权限,事实上,您已尝试将其删除。你应该写:chmod a+x /etc/cron.my/refresh.sh
另外,修改后重启cron服务
我创建了 bash 脚本并尝试执行它 manually.then 它工作正常。 之后我创建了 crontab 并将其设置为每 5 次执行一次 minutes.but 它不工作。
这是我的脚本
#!/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
您没有授予该脚本执行权限,事实上,您已尝试将其删除。你应该写:chmod a+x /etc/cron.my/refresh.sh
另外,修改后重启cron服务