Make schedular and queue run as www-data

This commit is contained in:
Deon George 2020-01-29 00:11:39 +11:00
parent 8237c6270c
commit f8bda40162

9
init
View File

@ -82,9 +82,12 @@ elif [ "$role" = "queue" -a -e artisan ]; then
echo "* Running the queue..." echo "* Running the queue..."
# We'll delay starting in case the app is caching # We'll delay starting in case the app is caching
sleep 15 sleep 15
su www-data -s /bin/sh -c "
while true; do while true; do
php ${PHP_OPTIONS} artisan queue:work --verbose --once --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} ${WORK_QUEUES:+--queue=${WORK_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}} php ${PHP_OPTIONS} artisan queue:work --verbose --once --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} ${WORK_QUEUES:+--queue=${WORK_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}}
done done
"
elif [ "$role" = "scheduler" -a -e artisan ]; then elif [ "$role" = "scheduler" -a -e artisan ]; then
if [ ! -e ${php}/.env ]; then if [ ! -e ${php}/.env ]; then
@ -96,10 +99,12 @@ elif [ "$role" = "scheduler" -a -e artisan ]; then
# We'll delay starting in case the app is caching # We'll delay starting in case the app is caching
sleep 15 sleep 15
while [ true ]; do su www-data -s /bin/sh -c "
php ${PHP_OPTIONS} artisan schedule:run --verbose --no-interaction & while true; do
(php ${PHP_OPTIONS} artisan schedule:run --verbose --no-interaction &)
sleep 60 sleep 60
done done
"
else else
echo "? NO container role \"${role}\", AND/OR no laravel install, just starting php-fpm" echo "? NO container role \"${role}\", AND/OR no laravel install, just starting php-fpm"