Code Monkey home page Code Monkey logo

Comments (11)

liebig avatar liebig commented on July 16, 2024

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.

from cron.

rbk008 avatar rbk008 commented on July 16, 2024

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 ..?

from cron.

liebig avatar liebig commented on July 16, 2024

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.

from cron.

rbk008 avatar rbk008 commented on July 16, 2024

Thank you liebig .....

from cron.

liebig avatar liebig commented on July 16, 2024

You are welcome!

from cron.

cronjobservices avatar cronjobservices commented on July 16, 2024

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

from cron.

liebig avatar liebig commented on July 16, 2024

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

from cron.

liebig avatar liebig commented on July 16, 2024

The link was added to the README file.

from cron.

cronjobservices avatar cronjobservices commented on July 16, 2024

@liebig Thanks.

from cron.

cawecoy avatar cawecoy commented on July 16, 2024

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?

from cron.

liebig avatar liebig commented on July 16, 2024

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...

from cron.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.