Skip to content

Commit 528864d

Browse files
Direct STDERR output when listing crontab to /dev/null
When installing crontab on systems using fcron the output from STDERR is captured and inserted into the updated crontab. An example from a fresh install follows. While fcron does not outright complain about this when saving the file, it is messy and quite avoidable. 2019-02-03 13:18:18 INFO listing magento's fcrontab #~ MAGENTO START 7cd0a74c421051ec6cce8936eb9edd02 * * * * * /usr/lib64/php7.2/bin/php /var/www/magento/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/magento/var/log/magento.cron.log * * * * * /usr/lib64/php7.2/bin/php /var/www/magento/update/cron.php >> /var/www/magento/var/log/update.cron.log * * * * * /usr/lib64/php7.2/bin/php /var/www/magento/bin/magento setup:cron:run >> /var/www/magento/var/log/setup.cron.log #~ MAGENTO END 7cd0a74c421051ec6cce8936eb9edd02
1 parent 911a6e6 commit 528864d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private function cleanMagentoSection($content)
182182
private function getCrontabContent()
183183
{
184184
try {
185-
$content = (string)$this->shell->execute('crontab -l');
185+
$content = (string)$this->shell->execute('crontab -l 2>/dev/null');
186186
} catch (LocalizedException $e) {
187187
return '';
188188
}

0 commit comments

Comments
 (0)