简体   繁体   English

如何使用Laravel 4和Digital Ocean Linux 12.04在cron选项卡中设置cron作业

[英]How to setup cron job in cron tab with Laravel 4 and Digital Ocean Linux 12.04

Greeting all 问候所有

I started working with Laravel 4 and I must say I just love it, and one of the stuffs I like about it is the artisan command. 我开始使用Laravel 4进行工作,我必须说我喜欢它,而我喜欢的东西之一是工匠命令。

And I created one, an artisan command that fetches posts from my database and tweets them to my official twitter page, my artisan command works pretty well and tweets the number of posts which I had set it to. 然后,我创建了一个artisan命令,该命令从数据库中获取帖子,并将其推文到我的官方Twitter页面,我的artisan命令运行得很好,并推文设置了我的帖子数。

Now my problem is the cron job, I need to set it up in the cron tab, so it can be tweeting an X-number of post titles over a 10 min period (I have read up on how to do the timing), what have been giving me some issues is how to get the path to artisan correctly in the cron tab editor and am using DIGITAL OCEAN Linux 12.04 with no additional panel. 现在我的问题是cron作业,我需要在cron选项卡中进行设置,因此它可以在10分钟内发布X数的帖子标题(我已经阅读了如何安排时间)给我一些问题是如何在cron选项卡编辑器中正确获取artisan的路径,以及如何使用没有其他面板的DIGITAL OCEAN Linux 12.04。

Look at how my file is organized (attached image) 查看文件的组织方式(附图) 网站结构

How do I set up the path to artisan in my cron tab? 如何在cron标签中设置工匠的路径?

I tried using this Cron Job in Laravel couldn't get it right. 我试图在Laravel中使用此Cron Job无法解决问题

Thanks. 谢谢。

Just use the Laravel 4 Dispatcher package: https://github.com/Indatus/dispatcher 只需使用Laravel 4 Dispatcher软件包即可: https : //github.com/Indatus/dispatcher

Then you can schedule this command, and many others through your application, rather than the server. 然后,您可以通过应用程序而不是服务器来调度此命令以及其他命令。

Laracasts has a (paid) lesson on this package here . Laracasts在这里有关于此套餐的(收费)课程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM