/** * Formats task for export into crontab file * @param TaskInterface $task * @param string $path * @param string $php_bin * @param string $input_file * @return string */ public static function getTaskCrontabLine($task, $path, $php_bin, $input_file) { $str = ''; $comment = $task->getComment(); if (!empty($comment)) { $str .= '#' . $comment . PHP_EOL; } if (TaskInterface::TASK_STATUS_ACTIVE != $task->getStatus()) { $str .= '#'; } list($class, $method, $args) = self::parseCommand($task->getCommand()); $exec_cmd = $php_bin . ' ' . $input_file . ' ' . $class . ' ' . $method . ' ' . implode(' ', $args); $str .= $task->getTime() . ' cd ' . $path . '; ' . $exec_cmd . ' 2>&1 > /dev/null'; return $str . PHP_EOL; }