Skip to content

Commit 10036f9

Browse files
committed
MAGETWO-70314: [Github] cron:install issues #10040
1 parent ec23f60 commit 10036f9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/internal/Magento/Framework/Crontab/CrontabManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ private function getCrontabContent()
168168
*/
169169
private function save($content)
170170
{
171-
$content = str_replace('%', '%%', $content);
171+
$content = str_replace(['%', '"'], ['%%', '\"'], $content);
172172

173173
try {
174174
$this->shell->execute('echo "' . $content . '" | crontab -');

lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,17 @@ public function saveTasksDataProvider()
328328
. ' /var/www/magento2/var/log/cron.log' . PHP_EOL
329329
. CrontabManagerInterface::TASKS_BLOCK_END . PHP_EOL,
330330
],
331+
[
332+
'tasks' => [
333+
['command' => '{magentoRoot}run.php % cron:run | grep -v "Ran \'jobs\' by schedule"']
334+
],
335+
'content' => $content,
336+
'contentToSave' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
337+
. CrontabManagerInterface::TASKS_BLOCK_START . PHP_EOL
338+
. '* * * * * ' . PHP_BINARY . ' /var/www/magento2/run.php'
339+
. ' %% cron:run | grep -v \"Ran \'jobs\' by schedule\"' . PHP_EOL
340+
. CrontabManagerInterface::TASKS_BLOCK_END . PHP_EOL,
341+
],
331342
];
332343
}
333344
}

0 commit comments

Comments
 (0)