YalcinSahin Şöyle bir şey mi istediğiniz:
Ana conf dosyasına şunu ekleyin:
[include]
files = /etc/supervisor/conf.d/customers/*.conf
Bu /etc/supervisor/conf.d/customers/ klasörü içindeki tüm config dosyalarını da conf içerisine dahil edecek. İstediğiniz klasörü gösterebilirsiniz ama supervisor'un erişim izni olan bir yer olmalı. Bir tane de müşteri için conf dosyası oluşturan bash script hazırlayın:
create-customer-conf.sh
#!/bin/bash
# Buradaki $1 sizin create-customer-conf.sh çalıştırırken vereceğiniz ilk komut satırı parametresi
# Yani program adı olacak. Örneğin:
# $ ./create-customer-conf.sh mail_customer1
# Burada $1 = mail_customer1 olmuş oluyor. İçeride ihtiyacınız olan yerde kullanırsınız.
FILE=/etc/supervisor/conf.d/customers/$1.conf
if [ -e "$FILE"]; then
echo "$1.conf zaten var!"
else
cat > $FILE <<-EOF
[program:$1]
process_name=%(program_name)s_%(process_num)02d
command=php /home/forge/app.com/artisan queue:work sqs --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=forge
numprocs=8
redirect_stderr=true
stdout_logfile=/home/forge/app.com/worker-$1.log
stopwaitsecs=3600
EOF
fi
Sonra bu dosyayı çalıştırılabilir hale getirin:
$ chmod u+x create-customer-conf.sh
Bir müşteriye conf oluşturmak için:
$ ./create-customer-conf.sh mail_customer1
Bu /etc/supervisor/conf.d/customers/mail_customer1.conf dosyasını oluşturacak ve gerisini supervisor halledecek. Elbette conf değişikliğini algılaması için ya önce stop sonra start yapacaksınız ya da önce reread sonra update.
Belki işinize yarar...