Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Setting a cron job with OIL
  • hi everyone and thanks for your time, today I am trying to create a task on windows 7 that will run a task file on fuelphp using oil, so what I did so far is creating the task on task schedule that will run php.exe first then as arguments "CD root/to/my/task/file oil r taskclass:method".
    Is this well done or may I change something to get it run.
    I am new to cron job in PHP so I hope you guys can help me, thanks.
  • HarroHarro
    Accepted Answer
    I'm not familiar with Windows, but the commandline should be:

    \path\to\php.exe \path\to\your\app\oil r taskclass:method

    unless php.exe is in your path, then php.exe should be enough. There is no cd needed, fuelphp doesn't care what the current working directory is.
  • Thanks lot :D I have solved it and it is working just fine, the only issue I am still facing is how to increment a field in my DB using DB:update(), this is what I am trying:

    //update query
    $query = \DB::update('myTable')->value('field','`field`+1')->where('id','=',1);
    //result response
    $response = $query->execute();
  • HarroHarro
    Accepted Answer
    You might need to use DB::expr("`field` + 1") to avoid it being seen as a literal value (a string).
  • Thanks lot and sorry for disturbing you :), <3 FuelPHP
  • HarroHarro
    Accepted Answer
    No worries, we're here to help ;-)

Howdy, Stranger!

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

In this Discussion