File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
lib/internal/Magento/Framework/Crontab Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,11 @@ public function removeTasks()
138
138
private function generateSection ($ content , $ tasks = [])
139
139
{
140
140
if ($ tasks ) {
141
+ // Add EOL symbol to previous line if not exist.
142
+ if (substr ($ content , -strlen (PHP_EOL )) !== PHP_EOL ) {
143
+ $ content .= PHP_EOL ;
144
+ }
145
+
141
146
$ content .= $ this ->getTasksBlockStart () . PHP_EOL ;
142
147
foreach ($ tasks as $ task ) {
143
148
$ content .= $ task ['expression ' ] . ' ' . PHP_BINARY . ' ' . $ task ['command ' ] . PHP_EOL ;
Original file line number Diff line number Diff line change @@ -337,6 +337,17 @@ public function saveTasksDataProvider()
337
337
. ' %% cron:run | grep -v \"Ran \'jobs \' by schedule\" ' . PHP_EOL
338
338
. CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5 (BP ) . PHP_EOL ,
339
339
],
340
+ [
341
+ 'tasks ' => [
342
+ ['command ' => '{magentoRoot}run.php % cron:run | grep -v "Ran \'jobs \' by schedule" ' ]
343
+ ],
344
+ 'content ' => '* * * * * /bin/php /var/www/cron.php ' ,
345
+ 'contentToSave ' => '* * * * * /bin/php /var/www/cron.php ' . PHP_EOL
346
+ . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . md5 (BP ) . PHP_EOL
347
+ . '* * * * * ' . PHP_BINARY . ' /var/www/magento2/run.php '
348
+ . ' %% cron:run | grep -v \"Ran \'jobs \' by schedule\" ' . PHP_EOL
349
+ . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5 (BP ) . PHP_EOL ,
350
+ ],
340
351
];
341
352
}
342
353
}
You can’t perform that action at this time.
0 commit comments