mercredi 3 février 2016

File permission of Log in Laravel 5.1

I'm using Laravel 5.1, with Log set to be generated daily.

I'm heavily using Jobs. Web server is Apache, so therefore PHP is executed as apache user, so at the end of the day, a new log file is generated by apache user and file permission is 0644. I've workers configured via Supervisor, which is being run by apache user. (So far so good)

Now for a random spike in Queue, I've a script setup to run more worker (Consumers of Queue). Problem I'm facing is since Log file is generated with 0644 permission, other users doesn't have write permission to file.

Few solutions I can think of is -

  • Start worker from root user (can't do, as I don't have permissions)
  • A cron to change file permission to 0646 at 00:00:00 each day (also requires root)
  • Generate Log file manually at 00:00:00 by current user, so that I would have authority to change permission to 0646 (Can't be reliable, what if apache creates it first)
  • Start the worker as apache user (Since no root, so this is not possible)
  • This Question on Unix SE Site

So my question is what is the best way to do it, it looks like a general problem to me, which any developer could face. Or is there any better way to do this apart from above mentioned methods.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1SXIHwB
via IFTTT

Aucun commentaire:

Enregistrer un commentaire