reload_flag=""
if [[ -n "${DEBUG}" ]]; then
reload_flag="--reload"
fi
if [[ -n "${WORKER_COUNT}" ]]; then
workers=${WORKER_COUNT}
else
workers=2
fi
gunicorn --workers ${workers} \
--bind 0.0.0.0:8000 \
${reload_flag} main.wsgi
Писали такие конструкции чтобы проверить наличие флага и сформировать команду правильно?
На самом деле можно сделать тоже самое проще. Для этого используются операторы условной подстановки, доступные в оболочках семейства POSIX.
:- для установки значений по умолчанию
${WORKER_COUNT:-2}
Если переменная не объявлена, то будет дефолтное значение 2.
:+ подставляет указанный текст, если переменная не пуста
${DEBUG:+--reload}
Если что-то есть в переменной то распечатается текст после символа +, в противном случае - ничего. Удобно для опциональных флагов, как в нашем примере.
Итого наш скрипт может выглядеть так:
gunicorn --workers ${WORKER_COUNT:-2} \
--bind 0.0.0.0:8000 \
${DEBUG:+--reload} main.wsgi
Есть еще два оператора.
:= не только подставить дефолтное значение, но и присвоить его переменной, если она пуста
# никаких переменных еще нет
VAL1=${VAL2:=hello}
# теперь доступны обе
echo $VAL1 $VAL2
# hello hello
:? остановить выполнение с ошибкой, если переменной нет.
echo ${MISS:?is required}
bash: MISS: is required
Код выхода будет 1.
#tricks#linux
♻️FEEDING GUIDE ON BROILER CHICKS
✅Starter Feed (0-3 weeks):
The starter feed is designed to provide the energy and
protein necessary for rapid growth during the first few
weeks of a broiler's life. It's typically higher in protein content
to support muscle and feather development.
✅Here's a typical formulation for starter feed:
Maize (Corn): 50-60% — Provides energy.
Soybean Meal: 25-30% — Rich in protein for growth.
Fish Meal/Meat Meal: 5-10% — Additional protein to boost
growth.
Wheat Bran: 5% — Source of fiber and micronutrients.
Limestone: 1-2% — Ensures proper bone development.
Dicalcium Phosphate: 1-2% — Provides phosphorus and
calcium for bone health.
Salt: 0.2-0.3% - Maintains electrolyte balance.
Vitamin and Mineral Premixes: As per manufacturer's
guidelines for the required nutrients.
Probiotics and Enzymes: 0.5-1% — Improves digestion and
nutrient absorption.
✅Grower Feed (3-6 weeks):
The grower feed formulation is slightly lower in protein than
the starter feed but still maintains enough protein to support
continued growth and muscle development.
♻️Typical grower feed formulation:
Maize (Corn): 55-65% — Provides energy for continued
growth.
Soybean Meal: 20-25% — Protein for muscle development.
Sunflower Meal: 5-10% — Additional protein source and
enhances digestibility.
Rice Bran: 5-10% — Provides energy and fats for increased
growth rate.
Wheat Bran: 2-5% — Fiber for digestion.
Limestone: 1-1.5% — Calcium for bone health.
Dicalcium Phosphate: 1-1.5% - Balanced phosphorus and
calcium.
Salt: 0.2-0.3% — Electrolyte balance.
Vitamin and Mineral Premixes: According to manufacturer
guidelines.
Probiotics and Enzymes: 0.5-1% — Support gut health and
nutrient absorption.
♻️Finisher Feed (6 weeks until market):
The finisher feed focuses on providing the final boost in
weight gain and ensures that broilers reach market weight
efficiently. It contains less protein than the grower feed, as
the chickens are now focusing more on fat deposition
#Dr.Amanuel
https://t.me/starvetbooks