cancel
Showing results for 
Search instead for 
Did you mean: 

Cron errors since upgrading from 2.1.x to 2.2.1

SOLVED

Cron errors since upgrading from 2.1.x to 2.2.1

Hello everyone!

 

I'm having an issue with the automated cron tasks ever since I upgraded the site. Everything else is working fine, but I get an email every time the cron task fails and it's starting to get overwhelming. I've tried to figure out what the cause of the issue is and I haven't had any luck, so I'm turning to you guys.

 

Whenever the cron tasks run now, I am getting the following:

Magento\Framework\Exception\FileSystemException] 
The file "/var/www/<sitename>/var/.update_in_progress.flag" cannot be deleted Warning!unlink(/var/www/<sitename>/var/.update_in_progress.flag): No such file or directory 


setup:cron:run [--magento-init-params MAGENTO-INIT-PARAMS]

The file doesn't exist, and I see in the other log files that it is having issues creating it. I've tried modifying permissions on the var/ folder and it doesn't seem to help any.

 

Any help at all is appreciated, thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Cron errors since upgrading from 2.1.x to 2.2.1

Yeah, I have tried creating the file, doesn't change anything. Maybe my crontab is messed up? Check it out and see if there's anything that seems out of the ordinary:

 

* * * * * /usr/bin/php /var/www/___________/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/___________/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/___________/bin/magento setup:cron:run | grep -v "Ran jobs by schedule" >> /var/www/___________/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/___________/update/cron.php >> /var/www/___________/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/___________/bin/magento setup:cron:run >> /var/www/___________/var/log/setup.cron.log
*/5 * * * * /usr/bin/php /var/www/___________/bin/magento indexer:reindex >> /var/www/___________/var/log/magento.cron.log

 

This crontab wasn't created by me personally. Should I update it to be like the one that Magento auto-generates? (shown below)

 

#~ MAGENTO START
* * * * * /usr/bin/php /var/www/html/magento2/bin/magento cron:run 2>&1 | grep -v Ran jobs by schedule >> /var/www/html/magento2/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/html/magento2/update/cron.php >> /var/www/html/magento2/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/html/magento2/bin/magento setup:cron:run >> /var/www/html/magento2/var/log/setup.cron.log
#~ MAGENTO END

View solution in original post

Re: Cron errors since upgrading from 2.1.x to 2.2.1

I'd go with the Magento one. The one that you have currently seems to have some duplicate lines which could mean it's trying to run the same thing twice. That might answer why it's trying to delete a file that's already been deleted by another cron process. 

 

I don't think there's need to run the magento index reindexer every 5 minutes either so best to go with with Magento generate. 

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!

View solution in original post

6 REPLIES 6

Re: Cron errors since upgrading from 2.1.x to 2.2.1

It does sound like a permissions problem. What changes did you try with the permission on the var directory? Which users and groups own that directory? What user is the cron running as?

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!

Re: Cron errors since upgrading from 2.1.x to 2.2.1

@Tom Robertshaw wrote:

It does sound like a permissions problem. What changes did you try with the permission on the var directory? Which users and groups own that directory? What user is the cron running as?


The var directory is in the www-data group, which is the group that Apache is a part of. I've tried doing:

chmod -R 777 var/

and I still get the same error, so I'm not sure if it's still a permissions error, though there's also a chance that I have no idea what I am doing Smiley Tongue Any other ideas? The errors are getting out of hand by this point and I am not sure how to stop them.

 

It can't delete the file because the file doesn't exist, but it seems like it is trying to create the file but it can't.

Re: Cron errors since upgrading from 2.1.x to 2.2.1

That is the right command to run. Did it run without any messages about permission denied?

 

Yeah, my thinking is the same as yours. While it is erroring when it's trying to delete the file you would have thought it not being there meant it had trouble writing the file in the first place. 

 

Not really sure what else to try. Have you tried cheekily creating the file manually and seeing what happens when it tries to delete it?

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!

Re: Cron errors since upgrading from 2.1.x to 2.2.1

Yeah, I have tried creating the file, doesn't change anything. Maybe my crontab is messed up? Check it out and see if there's anything that seems out of the ordinary:

 

* * * * * /usr/bin/php /var/www/___________/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/___________/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/___________/bin/magento setup:cron:run | grep -v "Ran jobs by schedule" >> /var/www/___________/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/___________/update/cron.php >> /var/www/___________/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/___________/bin/magento setup:cron:run >> /var/www/___________/var/log/setup.cron.log
*/5 * * * * /usr/bin/php /var/www/___________/bin/magento indexer:reindex >> /var/www/___________/var/log/magento.cron.log

 

This crontab wasn't created by me personally. Should I update it to be like the one that Magento auto-generates? (shown below)

 

#~ MAGENTO START
* * * * * /usr/bin/php /var/www/html/magento2/bin/magento cron:run 2>&1 | grep -v Ran jobs by schedule >> /var/www/html/magento2/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/html/magento2/update/cron.php >> /var/www/html/magento2/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/html/magento2/bin/magento setup:cron:run >> /var/www/html/magento2/var/log/setup.cron.log
#~ MAGENTO END

Re: Cron errors since upgrading from 2.1.x to 2.2.1

I'd go with the Magento one. The one that you have currently seems to have some duplicate lines which could mean it's trying to run the same thing twice. That might answer why it's trying to delete a file that's already been deleted by another cron process. 

 

I don't think there's need to run the magento index reindexer every 5 minutes either so best to go with with Magento generate. 

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!

Re: Cron errors since upgrading from 2.1.x to 2.2.1

Alright, cool.Yeah, it fixed the issue Smiley Happy