I want to use supervisord to make maintenance for Laravel application which used nginx run by www-data:www-data
user:group. Both Laravel app and supervisord task need to share one log file. Sometimes app writes something to log, in other cases - supervisor daemon does the same.
Add user to supervisord.conf:
[supervisord]
user=www-data
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
Then add user to supervisor task:
[program:neuroprofile-queue]
command=php artisan queue:work
directory=/home/vbulash/nginx.html/neuroprofile
user=www-data
autostart=true
autorestart=true
stderr_logfile=/home/vbulash/nginx.html/neuroprofile/storage/logs/queue.error.log
stdout_logfile=/home/vbulash/nginx.html/neuroprofile/storage/logs/queue.output.log
Then stop, start, reread and update supervisorctl.
Finally in /home/vbulash/nginx.html/neuroprofile/storage/logs/ :
- Newly created log file (output of supervisor command) has rights root:root. Laravel app can't write to this log because of limited permissions.
- queue.error.log has rights root:root
- queue.output.log has rights root:root
So, user setting in supervisor completely ignored.
How to force supervisor run as www-data:www-data
?