These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Minion: executing a different command in a task
  • I'm kind of stuck, I want to run a minion task that sets everything up so I can call a non-kohana command in CLI and pass the setup to it.

    This command outputs quite some information that's handy, so would it also be possible to show this info while it's processing?

    So I'd call for example: 'php minion module:scan'

    which would scan for info and store it in a JSON file, after the scan is completed it would need to call something like 'php modules build scanned.json' which would process the file.

    I'm familiar with Kohana's minion tasks, but have never tried something as this.

  • In your code when you need to run the next task:

    Minion_Task::factory(array(
        'task' => 'your:task', 
        'option' => 'value'
    ))->execute();
    

    https://github.com/kohana/minion/blob/3.3/master/classes/Kohana/Minion/Task.php#L58

    So probably:

    .... some code to create json file ...
    
    Minion_Task::factory(array(
        'task' => 'modules:build', 
        'file' => 'path/to/scanned.json',
    ))->execute();
    

    to execute classes/Task/Modules/Build.php, path will be in $this->_options['file'] of that Task_Modules_Build instance.

  • Thanks for this, but the command I need to run after preparing scanned.json is no kohana-based task 'php modules build scanned.json' means I'm calling a file named 'modules' with php which I call their bundled 'build' command with 'scanned.json' as the parameter.

    You solution is only possible for calling minion-based tasks

  • If it's not your script and you can't wrap it in a task, then just use exec(), system() or passthru() at the end of your first task. I'm not sure what the difficulty is to be honest, perhaps you could explain further?

  • thanks for that, yeah, I have no experience writing CLI scripts without Kohana points to first post but thanks for pushing me in the right direction ^^

  • Ah I see, well let us know how you get on :)

Howdy, Stranger!

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

In this Discussion