Created
June 3, 2020 13:30
-
-
Save toocool/308f0cd0c02c045d9f5b6642343c820c to your computer and use it in GitHub Desktop.
Bash script to execute artisan based on the env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
role=${CONTAINER_ROLE:-app} | |
env=${APP_ENV:-production} | |
if [ "$role" = "app" ]; then | |
exec apache2-foreground | |
elif [ "$role" = "queue" ]; then | |
echo "Running the queue..." | |
php /var/www/html/artisan queue:work --memory=3800 --queue=bigjob --timeout=9600 --tries=1 | |
elif [ "$role" = "scheduler" ]; then | |
while [ true ] | |
do | |
php /var/www/html/artisan schedule:run --verbose --no-interaction & | |
sleep 60 | |
done | |
else | |
echo "Could not match the container role \"$role\"" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment