我正在尝试通过after.sh
配置主管工作但由于某种原因,我不断收到许多权限错误。任何人都有任何想法如何解决这些问题?
after.sh
# Add the laravel service to supervisor
if [ ! -f /etc/supervisor/conf.d/laravel-worker.conf ]; then
laravel_worker_block="[program:term-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/vagrant/laravel/artisan queue:work sqs-term --sleep=3 --tries=3
autostart=true
autorestart=true
user=vagrant
numprocs=8
redirect_stderr=true
stdout_logfile=/home/vagrant/laravel/term-worker.log
[program:default-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/vagrant/laravel/artisan queue:work sqs-default --sleep=3 --tries=3
autostart=true
autorestart=true
user=vagrant
numprocs=8
redirect_stderr=true
stdout_logfile=/home/vagrant/laravel/default-worker.log"
echo "$laravel_worker_block" > "/etc/supervisor/conf.d/laravel-worker.conf"
supervisorctl reread
supervisorctl update
fi
错误
==> default: /tmp/vagrant-shell: 38: /tmp/vagrant-shell: cannot create /etc/supervisor/conf.d/laravel-worker.conf: Permission denied
==> default: error: <class 'socket.error'>, [Errno 13] Permission denied: file: /usr/lib/python2.7/socket.py line: 228
==> default: error: <class 'socket.error'>, [Errno 13] Permission denied: file: /usr/lib/python2.7/socket.py line: 228
答案 0 :(得分:2)
我能够通过添加一些sudo来修复它。
# Add the laravel service to supervisord
if sudo [ ! -f /etc/supervisor/conf.d/laravel-worker.conf ]; then
laravel_worker_block="[program:term-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/vagrant/laravel/artisan queue:work sqs-term --sleep=3 --tries=3
autostart=true
autorestart=true
user=vagrant
numprocs=8
redirect_stderr=true
stdout_logfile=/home/vagrant/laravel/term-worker.log
[program:default-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/vagrant/laravel/artisan queue:work sqs-default --sleep=3 --tries=3
autostart=true
autorestart=true
user=vagrant
numprocs=8
redirect_stderr=true
stdout_logfile=/home/vagrant/laravel/default-worker.log"
sudo sh -c "echo '$laravel_worker_block' > '/etc/supervisor/conf.d/laravel-worker.conf'"
sudo supervisorctl reread
sudo supervisorctl update
fi