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()
138138 private function generateSection ($ content , $ tasks = [])
139139 {
140140 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+
141146 $ content .= $ this ->getTasksBlockStart () . PHP_EOL ;
142147 foreach ($ tasks as $ task ) {
143148 $ 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()
337337 . ' %% cron:run | grep -v \"Ran \'jobs \' by schedule\" ' . PHP_EOL
338338 . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5 (BP ) . PHP_EOL ,
339339 ],
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+ ],
340351 ];
341352 }
342353}
You can’t perform that action at this time.
0 commit comments