Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
tasks as cron job
  • hiiiii;
    please helppppp!!!
    how can i set up tasks as a cron job . i want that my taks run everyday .

    thanks
  • very easy:

    cd /your/fuel/installation; env FUEL_ENV=production /usr/bin/php oil refine yourtask

    (or whatever the environment is you want to run your task in)
  • hiii Harro Verton,
    thank you, but my problem is that I do not know how to mention for example that the task must execute every day
  • depends a bit on the operating system.

    On most linux machines, you have an /etc/cron.d directory for custom schedules, and folders like /etc/cron.hourly, /etc/cron.daily and /etc/cron.monthly, that run at a fixed time,

    If you want to use a custom schedule, create a file (name doesn't matter) in /etc/cron.d, with something like:

    0 2 * * * root cd /your/fuel/installation; env FUEL_ENV=production /usr/bin/php oil refine yourtask

    This will run the task every day at 02:00, as user root.

    If you Google cron, you'll find plenty of examples on how you can specify times using the first 5 fields of this line.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion