enable/disable flags for Horizon and Scheduler.

This commit is contained in:
Greyscale 2023-03-02 16:41:01 +01:00
parent b93953c004
commit 92149958ca
No known key found for this signature in database
GPG key ID: 74BAFF55434DA4B2
2 changed files with 34 additions and 24 deletions

View file

@ -2,21 +2,26 @@
rm -f /var/lock/laravel_horizon_started
# If horizon is present, publish the frontend assets, if HORIZON_UI is set to "on"
if [[ -f "/app/config/horizon.php" ]]; then
echo "[HORIZON] Waiting until Migration Complete."
until [ -f /var/lock/laravel_migration_complete ]
do
sleep 1
done
echo "[HORIZON] Migration is complete, running Horizon."
if [ "${HORIZON_UI,,}" = "on" ]; then
echo "[HORIZON] Publishing horizon frontend assets"
artisan horizon:publish
if [ "${HORIZON_ENABLE,,}" = "on" ]; then
if [[ -f "/app/config/horizon.php" ]]; then
echo "[HORIZON] Waiting until Migration Complete."
until [ -f /var/lock/laravel_migration_complete ]
do
sleep 1
done
echo "[HORIZON] Migration is complete, running Horizon."
if [ "${HORIZON_UI,,}" = "on" ]; then
echo "[HORIZON] Publishing horizon frontend assets"
artisan horizon:publish
fi
echo "[HORIZON] Running laravel horizon runner"
cpulimit -l 30 -- artisan horizon
touch /var/lock/laravel_horizon_started
else
echo "[HORIZON] Horizon is not present."
fi
echo "[HORIZON] Running laravel horizon runner"
cpulimit -l 30 -- artisan horizon
touch /var/lock/laravel_horizon_started
else
echo "[HORIZON] Horizon is not present"
echo "[HORIZON] Not enabled. To enable this feature, set HORIZON_ENABLE = on."
fi
sleep infinity

View file

@ -1,12 +1,17 @@
#!/bin/bash
cd /app
echo "[SCHEDULER] Waiting until Migration Complete."
until [ -f /var/lock/laravel_migration_complete ]
do
sleep 1
done
echo "[SCHEDULER] Migrations complete, starting scheduler"
while true; do
artisan schedule:run
sleep 59;
done
if [ "${SCHEDULER_ENABLE,,}" = "on" ]; then
echo "[SCHEDULER] Waiting until Migration Complete."
until [ -f /var/lock/laravel_migration_complete ]
do
sleep 1
done
echo "[SCHEDULER] Migrations complete, starting scheduler"
while true; do
artisan schedule:run
sleep 59;
done
else
echo "[SCHEDULER] Not enabled. To enable this feature, set SCHEDULER_ENABLE = on."
fi