30 lines
659 B
Bash
30 lines
659 B
Bash
#!/usr/bin/env bash
|
|
|
|
# From https://stackoverflow.com/a/76488746/17320077
|
|
|
|
work=true
|
|
|
|
function stopQueues() {
|
|
echo "Stopping queues..."
|
|
work=false
|
|
php artisan queue:restart
|
|
sleep 45s
|
|
exit 0
|
|
}
|
|
|
|
# handle graceful shutdown
|
|
trap "" SIGPIPE
|
|
trap stopQueues EXIT
|
|
|
|
echo "Starting PHP queue workers..."
|
|
|
|
while $work; do
|
|
php artisan queue:work database --queue=default,database --sleep=3 --tries=3 --max-time=3600 --no-interaction
|
|
sleep 1
|
|
done
|
|
|
|
# Si besoin de plusieurs threads puis terminer par un done sans &
|
|
#(while $work; do
|
|
# php artisan queue:work --queue="$(grep -oP 'SQS_QUEUE=\K.*' .env)" --no-interaction
|
|
# sleep 1
|
|
#done &)
|