Conversation
There was a problem hiding this comment.
This obviously cannot work, here the $file variable would be empty. You can simply delete the file after $process->run();
There was a problem hiding this comment.
yeap, my fault. my comment was more towards the solution:
$job = '* * * * * command.sh';
$process = new Process('crontab '.$job);
to avoid unnecessary I/O
There was a problem hiding this comment.
Would it work with multiline crons?
There was a problem hiding this comment.
i'm not sure if i understand, can you give me some example?
if by multiple crons you mean multiple commands in one $file, than you can just simply call new Process multiple times, no?
There was a problem hiding this comment.
When you call $this->getRaw(), you get the fullist of crons that should replace the current cron table.
If you have several crons, they will be separated by PHP_EOL chars.
So my question is, when calling $process = new Process('crontab '.$this->getRaw().PHP_EOL); does it work?
There was a problem hiding this comment.
i see. well if you are replacing the whole crontab, than you would have to drop existing crons (duno how exactly crontab works, but google is our friend)
and adding crons like should work (again google is friend):
join(PHP_EOL, $this->getRaw())
ofc you would have to try
my point is, that doing unnecessary I/Os and creating mess in /tmp dir is messy
There was a problem hiding this comment.
Well are you up to fix your PR then?
There was a problem hiding this comment.
nope, sorry, not in the near future
|
#44