Firstly please don't label it as duplicate as I have tried everything suggested in other answers.
Issue is that content of generated dir does not generate properly. Because generated dir is never empty when compiling. If I delete the content in generated manually it gets populated again because of cron. Like if I delete it get deleted but reappears after a few seconds. As to my understanding there are some files missing when content is populated/generated by cron.
I tried to remove cron but I am unable to remove it. Cron was created by root user.
When cron generates the dir "code", inside "generated" some of dir and files inside "code" are owned by root. Rest of the web root is set to www-data:www-data.
Please let me know if these is something you guys can suggest to fix it.
#~ MAGENTO START 40d1b2d83998fabacb726e5bc3d22129 * * * * * /usr/bin/php7.1 /var/www/html/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/html/var/log/magento.cron.log * * * * * /usr/bin/php7.1 /var/www/html/update/cron.php >> /var/www/html/var/log/update.cron.log * * * * * /usr/bin/php7.1 /var/www/html/bin/magento setup:cron:run >> /var/www/html/var/log/setup.cron.log #~ MAGENTO END 40d1b2d83998fabacb726e5bc3d22129
Not sure how to remove it now, tried bin/magento cron:remove
Tried crontab -e and commenting it out