Closed plesiosaure closed 3 years ago
Hi, Obviously I have to change the run user for the cron job according to the official manual and I'll do this a little bit later. But I don't think your problem because of that. There seems to be confusion between the system user and the app user. Developers not recommend to run cron as the root user because of security reason of a system itself on which app is hosted. But this has nothing to do with users access in the app.
When running as root, you got an access error: your user with login 'cron' has no access to the app because of wrong credentials. Make sure that the user with this login exists in the app and the password is correct (in file /etc/itop-cron.params). When running as www-data you didn't get any messages because (I suggest) www-data doesn't have the write permission on the log file (/var/log/itop-cron.log) that was created by root user during the first run. An empty output with the verbose option enabled also indicates this problem with file write permissions.
Confirm or deny this suggestion by running cron.php script from different system users without redirecting output to the log:
root@6fe8aedb4a46:/# sudo -u www-data php /var/www/html/webservices/cron.php --auth_user=admin --auth_pwd=123456 --verbose=1
You are perfectly right. I just made a confusion between iTop user account and Linux user account. It's clearly said in your Readme but not in the app documentation. Thanks.
Hello, According to https://www.itophub.io/wiki/page?id=2_7_0%3Aadmin%3Acron, you should "not run cron.php using root user. You must launch the command with the same user that is used by the web server running iTop." (www-data)
With root : /var/log/itop-cron.log : contains
Access wrong credentials ('cron')
With www-data, there is no message (cron seems OK but automatic backup is not working : select * from priv_backgroundtask; returns empty set.)/var/log/cron.log : contains :
The second line (No MTA installed) is only there in the case of www-data user executing (not root) : this probably means the cron is not correctly executed with root. apt install postfix && mkfifo /var/spool/postfix/public/pickup && service postfix restart fixed this issue (and also the test email issue : no valid recipient)
Note that adding parameter --verbose=1 does not provide more info in logs
Thank you