From f8bda401626dd1a78bf45354cf7253363f8ce91c Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 29 Jan 2020 00:11:39 +1100 Subject: [PATCH] Make schedular and queue run as www-data --- init | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/init b/init index 84c1112..fb335d9 100755 --- a/init +++ b/init @@ -82,9 +82,12 @@ elif [ "$role" = "queue" -a -e artisan ]; then echo "* Running the queue..." # We'll delay starting in case the app is caching sleep 15 + + su www-data -s /bin/sh -c " 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}} done + " elif [ "$role" = "scheduler" -a -e artisan ]; 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 sleep 15 - while [ true ]; do - php ${PHP_OPTIONS} artisan schedule:run --verbose --no-interaction & + su www-data -s /bin/sh -c " + while true; do + (php ${PHP_OPTIONS} artisan schedule:run --verbose --no-interaction &) sleep 60 done + " else echo "? NO container role \"${role}\", AND/OR no laravel install, just starting php-fpm"