1

I read many about problems with setup magento CRON but I don't find something about this error message with putty ssh connection:

Error during saving of crontab: sh: line 6: crontab: command not found

It is a new Magento 2.2.6 installation.

Where is my mistake?

With Mag 1.9 I had zero problems to activate the CRON. But the Mag 2 seems very complicated.

4
  • Please share what command you have run on putty for add crontab
    – Amit Bera
    Oct 5, 2018 at 12:04
  • I use: php bin/magento cron:install
    – Marcel
    Oct 5, 2018 at 12:09
  • So, you want to run cron manually ?
    – Amit Bera
    Oct 5, 2018 at 12:12
  • At first yes but in future with a cronjob. With Mag 1.9 I make a cronjob that trigger the cron.php but in Mag 2 i have no plan.
    – Marcel
    Oct 5, 2018 at 12:16

3 Answers 3

1

Check out, the document

I guess that you have added cron from cpanel

In order to php bin/magento cron:install

First, your current Cli user have any record at crontab. So, Check existing cron list using below code

crontab -l

You have to add magento cron

* * * * * /usr/bin/php /{ProjectPath}/bin/magento cron:run | grep -v Ran jobs by schedule >> /{ProjectPath}/var/log/magento.cron.log
* * * * * /usr/bin/php /{ProjectPath}/update/cron.php >> /{ProjectPath}/var/log/update.cron.log
* * * * * /usr/bin/php /{ProjectPath}/bin/magento setup:cron:run >> /{ProjectPath}/var/log/setup.cron.log
7
  • When I use the command crontab -l I get bash: crontab: command not found
    – Marcel
    Oct 5, 2018 at 12:51
  • In the system.log I find these lines after main.Error: echo [2018-10-04 07:13:41] #~ MAG START 7886code....... * * * * * /usr/bin/php70 /www/htdocs/xxx/xxx/magento2.2/bin/magento cron:run 2>&1 | grep -v \"Ran jobs by schedule\" >> /www/htdocs/xxx/xxx/magento2.2/var/log/magento.cron.log * * * * * /usr/bin/php70 /www/htdocs/xxx/xxx/magento2.2/update/cron.php >> /www/htdocs/xxx/xxx/magento2.2/var/log/update.cron.log * * * * * /usr/bin/php70 /www/htdocs/xxx/xxx/magento2.2/bin/magento setup:cron:run >> /www/htdocs/xxx/xxx/magento2.2/var/log/setup.cron.log #~ MAG END 788code..
    – Marcel
    Oct 5, 2018 at 12:56
  • How you have add cron job for magento 1?
    – Amit Bera
    Oct 5, 2018 at 13:10
  • I can create it on the administration from my hoster. I can set a Path and time.
    – Marcel
    Oct 5, 2018 at 13:12
  • 3 cron , need to be at cronjobn list that is enough for magento cron
    – Amit Bera
    Oct 5, 2018 at 13:16
0

Now I find out. I cant create a crontab (Shared-Server). The only way is to create a cronjob by my hoster "all inkl" and call pub/cron.php with the cronjob. In this case this article was helpfull. I've adjust the .htaccess in the /pub with password protection for the cron.php file. Now the cron works.

0

I think you should check again cronjob installed in the environment? You should use the command:

service --status-all
**or** 
ps aux | grep "cron"

If your environment is not installed cronjob

1, Install cronjob for ubuntu, Debian:

sudo apt-get update
sudo apt-get install cron

2, Go to the workspace folder

composer install
php bin/magento cron:install
crontab -l

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.