[英]Log file is being created with root user
I have setted a cron using schedule funcion in kernel.php
file of laravel. 我在kernel.php
文件中使用schedule kernel.php
设置了一个cron。 It is calling a method which is writing logs. 它正在调用一个写日志的方法。
My problem is log file is created with root user. 我的问题是用root用户创建日志文件。 Can I set the permissions of the file or execute that cron with a certain user? 我可以设置文件的权限或与特定用户执行该cron吗?
You can change the file permission with the user you want with this command: 您可以使用此命令通过所需的用户更改文件权限:
cd path-to-log-folder && chown your-user:your-group file-name
Otherwise, you can set the cronjob run by a specific user with this command: 否则,您可以使用以下命令设置特定用户运行的cronjob:
crontab -u your-user -e
and change the ownership of your log file with the same user (I prefer this way). 并使用相同的用户更改日志文件的所有权(我更喜欢这种方式)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.