My server is running on Ubuntu and nginx. My problem concerns Cron, I'd like to start it (crontab) using a file - cron.txt, its content:
* * * * * /usr/bin/php /var/www/html/test.php >> /var/log/cron.log
If I run it using a command:
crontab /var/www/html/cron.txt, it works perfectly, script test.php is being executed. But when I do the same but using a PHP script (executing via browser):
exec('crontab /var/www/html/cron.txt');, it doesn't work.
Checking current cronjob by command:
crontab -l -u www-data, the line from the file appears, but Cron does not do its job. Maybe it's related to some permission issues? Because it only works by executing as a root. Is there a way to force Cron to do www-data's tasks as well?