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..."
# 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"