Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

will cron queue work in localhost ? #8

Closed
rbk008 opened this issue Nov 20, 2013 · 11 comments
Closed

will cron queue work in localhost ? #8

rbk008 opened this issue Nov 20, 2013 · 11 comments
Assignees
Labels

Comments

@rbk008
Copy link

rbk008 commented Nov 20, 2013

I am beginner to the laravel 4 and cron queue. I want to use the cron queue to post the posts to facebook page in particular time . Can any one help ..?

@ghost ghost assigned liebig Nov 20, 2013
@liebig
Copy link
Owner

liebig commented Nov 20, 2013

Hi rbk008,
please have a look at the Readme file at https://github.com/liebig/cron
First go through the installation steps. After that have a look at the full example section which describes exactly how you can use Cron with Laravel. Finally use Cron::add to add a job which posts to facebook.
I think the Readme is a good start for you and will help you to posts to facebook in particular time.

@liebig liebig closed this as completed Nov 20, 2013
@rbk008
Copy link
Author

rbk008 commented Nov 20, 2013

Thank you liebig ..... i have one more question [] i need to buy or rent a server or service which to call the defined cron route ..?

@liebig
Copy link
Owner

liebig commented Nov 20, 2013

Yes, you need something which calls the defined route. PHP does only work when you call it (with a request or via console). Some hoster provide you cron jobs with your webspace package. If your hoster doesen't support cron jobs you can use a provider like https://www.setcronjob.com. Google is your friend ;) The Cron library only checks, when it is called (via the defined route) which Cron jobs have to be called (cron expression matchs with current time stamp). So Cron will be called with your hoster cron job or from a cron job provider and Cron will check and run your defined jobs.

@rbk008
Copy link
Author

rbk008 commented Nov 20, 2013

Thank you liebig .....

@liebig
Copy link
Owner

liebig commented Nov 20, 2013

You are welcome!

@cronjobservices
Copy link

Another list of free cron jobs can be found here: http://www.cronjobservices.com.

@liebig
Copy link
Owner

liebig commented Feb 11, 2014

Thank you, cronjobservices, I will add this to the README.

@liebig
Copy link
Owner

liebig commented Feb 11, 2014

The link was added to the README file.

@cronjobservices
Copy link

@liebig Thanks.

@cawecoy
Copy link

cawecoy commented May 7, 2014

I am working on a localhost (dev environment) and it's not work. The job is not running on the specified time. By the way, the crontab is working fine through terminal. So, won't it work on localhost?

@liebig
Copy link
Owner

liebig commented May 8, 2014

Hi cawecoy, thanks for using Cron. This library will work on localhost, too. Please use the brand new command. First update to head. The command cron:run will fire the event cron.collectJobs and then will run Cron. So you need to add an event listener to start/global.php (or start/development.php if you configured this environment in your bootstrap/start.php file) and then run php artisan cron:run with crontab. Here is the example code for your global.php file:

Event::listen('cron.collectJobs', function($rundate)
{
    Cron::add('example1', '* * * * *', function() {
                    // Do some crazy things not successfully every minute
                    return 'No!';
                });

    Cron::add('example2', '* * * * *', function() {
        // Do some crazy things successfully every minute
    });
});

Please don't forget to configure crontab to run the command every minute, because the example jobs need to be called every minute...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants