使用CURL在Cpanel中运行Cron作业

我在laravel中有一个代码,我想在cpanel中设置cron作业,但我不知道该怎么做。我看到了几个文件名为cron的示例,但是我正在使用Laravel,如何将其指向URL路由?

/usr/bin/curl https://example.com/cron_route

我不确定这是正确的方法还是可以用不同的方式做到这一点,所以我不能使用laravel artisan Scheduler,我拥有所有自定义代码和自定义Controller。

有人可以帮我吗?

nishiwoderena222 回答:使用CURL在Cpanel中运行Cron作业

尝试此命令

   1 1 * * 0  /usr/bin/curl -m 120 -s https://example.com/cron_route &>/dev/null
,

要使用命令行添加cronjob,请使用此命令

0 2 * * * wget -q -O /dev/null http://example.com/cron_script

请参阅以供参考:https://crontab.guru/

本文链接:https://www.f2er.com/3073399.html

大家都在问