I use cron to execute some php scripts (owncloud background tasks etc). My server runs nginx and PHP via php-fpm, which by default runs PHP processes under the
apache user, the only user with write access to
/var/www aside from root. Thus it should be fine to add these background jobs to apache`s crontab:
crontab -u apache -e
MAILTO=cron@localhost * * * * * echo "..." | mail -s "crontest" cron@localhost
This should send me a mail every minute, however it does not. When I run the command as the apache user (
sudo -s -u apache), it works fine, but the cronjob never executes.
I found some mention of "locked accounts" here, but I'm not sure if the suggested solution is a good idea.