简体   繁体   中英

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.

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.

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.

Look at how my file is organized (attached image) 网站结构

How do I set up the path to artisan in my cron tab?

I tried using this Cron Job in Laravel couldn't get it right.

Thanks.

Just use the Laravel 4 Dispatcher package: 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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