0,5 * * * * sudo /bin/chown -R www-data /var/www/pdf/ && sudo /bin/chgrp -R www-data /var/www/pdf/
First off, the chgrp
is redundant, you can manage the same with the chown
command itself.
So instead of doing sudo /bin/chown -R www-data /var/www/pdf/ && sudo /bin/chgrp -R www-data /var/www/pdf/
, you can do sudo /bin/chown -R www-data:www-data /var/www/pdf
Next instead of 0,5 * * * *
as your cron frequency, run it using */5 * * * *
Finally, instead of adding cron to a user's crontab
with sudo
/ to systemwide cron using /etc/cron.d
, add it to the root user's crontab using
sudo crontab -e
*/5 * * * * /bin/chown -R www-data:www-data /var/www/pdf/