/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $task_id = $this->argument('task_id');
     $task = Task::find($task_id);
     $task->is_running = 0;
     $task->save();
     $manager = new TaskManager($task);
     $manager->unlock();
 }
Exemple #2
0
 public function fire()
 {
     $manager = new TaskManager(Task::findOrFail($this->argument('task_id')));
     if (!$this->option('bg')) {
         //$this->info( 'Running without bg' );
         $manager->run($this);
     } else {
         //$this->info( 'Running in bg' );
         $manager->runInBackground();
     }
 }
 public function fire()
 {
     $rows = [];
     $tasks = Task::all();
     foreach ($tasks as $task) {
         $tm = new TaskManager($task);
         $rows[] = [$task->id, $task->title, $task->is_running ? '<fg=yellow;options=bold>' . $tm->info->getProgress() . '%</>' : '<fg=magenta>No</>', $task->last_run];
     }
     $table = $this->getHelper('table');
     $this->line('');
     $this->table(array('id', 'title', 'running', 'last run'), $rows);
     $this->line('');
 }
Exemple #4
0
 public function getAll()
 {
     return Task::all();
 }
 public function fire()
 {
     $task_id = $this->argument('task_id');
     $cmd = new TaskManager(Task::findOrFail($task_id));
     $cmd->stop();
 }