I want to run a crontab command every 5 mins that executes a py script. The py script inturn generates a log file with midnight rotation within /var/www/logs/.The logs dir has 777 permission.
The log file has midnight rotation and when new file is created,it creates as root owner.How to ensure the ownership stays as www-data as some other scripts also write to the same file and having root ownership causes permission issue for other scripts.
One way is to put the command in,
crontab -u www-data -e
This works fine, but i want to maintain all my cron commands under root user.
I tried doing the same with sudo, but it creates with root as owner which not what i want.