如何在 Octobercms 中使用 cronjob?
how to use cronjob in Octobercms?
假设我想在 octobercms 中的 cronjob 的帮助下从我的数据库中删除 id=50 的记录,执行此操作的步骤是什么
我做了以下事情来实现这个
1)- 在我的插件中我输入了以下代码
public function registerSchedule($schedule)
{
$schedule->call(function() {
DB::table('fsz_posting_tblposting')->where('id', '==', 50)->delete();
}); // Defaults to every minute (every execution)
}
2)- 在我的服务器的 cronjob 区域我放置了以下 cronjob 命令
/usr/local/bin/php -q /home3/user/public_html/artisan scheduled:run
完成这两个步骤后,我的记录没有被删除,我的收件箱中收到了以下电子邮件
"scheduled" 命名空间中没有定义任何命令。
你是这个意思吗?
时间表
我现在该怎么办?
您的 crontab 条目中似乎有一些拼写错误
its schedule:run not scheduled:run [schedule]
更正条目:
/usr/local/bin/php -q /home3/user/public_html/artisan schedule:run
有关更多信息,请参阅此处:
设置:https://octobercms.com/docs/setup/installation#crontab-setup
如何添加任务: https://octobercms.com/docs/plugin/scheduling
如有疑问请评论。
假设我想在 octobercms 中的 cronjob 的帮助下从我的数据库中删除 id=50 的记录,执行此操作的步骤是什么
我做了以下事情来实现这个
1)- 在我的插件中我输入了以下代码
public function registerSchedule($schedule)
{
$schedule->call(function() {
DB::table('fsz_posting_tblposting')->where('id', '==', 50)->delete();
}); // Defaults to every minute (every execution)
}
2)- 在我的服务器的 cronjob 区域我放置了以下 cronjob 命令
/usr/local/bin/php -q /home3/user/public_html/artisan scheduled:run
完成这两个步骤后,我的记录没有被删除,我的收件箱中收到了以下电子邮件
"scheduled" 命名空间中没有定义任何命令。
你是这个意思吗?
时间表
我现在该怎么办?
您的 crontab 条目中似乎有一些拼写错误
its schedule:run not scheduled:run
[schedule]
更正条目:
/usr/local/bin/php -q /home3/user/public_html/artisan schedule:run
有关更多信息,请参阅此处:
设置:https://octobercms.com/docs/setup/installation#crontab-setup
如何添加任务: https://octobercms.com/docs/plugin/scheduling
如有疑问请评论。