-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
removed random log #46
base: master
Are you sure you want to change the base?
Conversation
$file = \tempnam(\sys_get_temp_dir(), 'cron'); | ||
|
||
\file_put_contents($file, $this->getRaw().PHP_EOL); | ||
|
||
$process = new Process('crontab '.$file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it work with multiline crons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well are you up to fix your PR then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, sorry, not in the near future
|
#44