public write ( |
||
$crontab | ||
리턴 |
public function write(Crontab $crontab)
{
$tmpFile = tempnam(sys_get_temp_dir(), 'cron');
$this->writeToFile($crontab, $tmpFile);
$process = new Process($this->crontabCommand($crontab) . ' ' . $tmpFile);
$process->run();
$this->error = $process->getErrorOutput();
$this->output = $process->getOutput();
return $this;
}
/** * Save crons to file * * @param string $file /path/to/file/ */ public function save() { $crontabFile = $this->getCrontabFile(); if (!is_null($crontabFile)) { $this->crontabFileHandler->writeToFile($this->crontab, $crontabFile); } else { $this->crontabFileHandler->write($this->crontab); } return $this; }