Site down after scheduler run

I’m running a grav on wordops which is a basic PHP setup which keeps going down (blank page 500 or 503 I think). After resetting the permissions back as per the permissions reset script below and all is well again for a little while, then it happens again. I did suspect it was because php-fpm is running as root, but after more testing it looks like it is scheduler changing the permissions. As below, you can see that www-data does not have write permissions after scheduler has run.
-rw-r--r-- 1 botanica www-data 244584 May 26 05:01 master-localhost.php

Have I set this up wrong? Is there a correct way? DO I have to run crontab as www-data user?

Reset Script

chown -R www-data:www-data .
find . -type f -exec chmod 664 {} \;
find ./bin -type f -exec chmod 775 {} \;
find . -type d -exec chmod 775 {} \;
find . -type d -exec chmod +s {} \;


: PHP Fatal error:  Uncaught RuntimeException: Failed to save file /var/www/ in /var/www/
Stack trace:
#0 /var/www/ RocketTheme\Toolbox\File\File->save(Array)
#1 /var/www/ RocketTheme\Toolbox\File\PhpFile->save(Array)
#2 /var/www/ Grav\Common\Config\CompiledBase->saveCompiledFile('/var/www/botani...')
#3 /var/www/ Grav\Common\Config\CompiledBase->load()
#4 /var/www/ Grav\Common\Service\ConfigServiceProv" while reading response header from upstream, client:, server:, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php73-fpm.sock:", host: ""
2020/05/24 00:10:10 [error] 2043#2043: *654 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught RuntimeException: Failed to save file /var/www/ in /var/www/

Other mentions of the same problem with no solution and my thread on WordOps community.