added a help system, replaced the words "tenant" and "Pwa" with better alternatives. corrected and implemented cron jobs. prepared going live on a coolify-powered system.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Archive dispatcher cron skeleton
|
||||
# Archive dispatcher cron job
|
||||
# Run nightly to move completed events to cold storage
|
||||
|
||||
set -euo pipefail
|
||||
@@ -8,6 +8,25 @@ set -euo pipefail
|
||||
APP_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$APP_DIR"
|
||||
|
||||
# Replace with finalized artisan command that queues archive jobs
|
||||
/usr/bin/env php artisan storage:archive-pending --quiet
|
||||
LOG_DIR="$APP_DIR/storage/logs"
|
||||
mkdir -p "$LOG_DIR"
|
||||
LOG_FILE="$LOG_DIR/cron-archive-dispatcher.log"
|
||||
LOCK_FILE="$LOG_DIR/archive_dispatcher.lock"
|
||||
|
||||
exec 200>"$LOCK_FILE"
|
||||
if ! flock -n 200; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
timestamp() {
|
||||
date --iso-8601=seconds
|
||||
}
|
||||
|
||||
echo "[$(timestamp)] Starting storage:archive-pending" >> "$LOG_FILE"
|
||||
if /usr/bin/env php artisan storage:archive-pending --no-interaction --quiet >> "$LOG_FILE" 2>&1; then
|
||||
echo "[$(timestamp)] storage:archive-pending completed" >> "$LOG_FILE"
|
||||
else
|
||||
status=$?
|
||||
echo "[$(timestamp)] storage:archive-pending failed (exit $status)" >> "$LOG_FILE"
|
||||
exit $status
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Storage monitor cron skeleton
|
||||
# Storage monitor cron job
|
||||
# Usage: configure cron to run every 5 minutes
|
||||
|
||||
set -euo pipefail
|
||||
@@ -8,7 +8,25 @@ set -euo pipefail
|
||||
APP_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$APP_DIR"
|
||||
|
||||
# Collect storage statistics and cache them for the dashboard
|
||||
# Customize the artisan command once implemented
|
||||
/usr/bin/env php artisan storage:monitor --quiet
|
||||
LOG_DIR="$APP_DIR/storage/logs"
|
||||
mkdir -p "$LOG_DIR"
|
||||
LOG_FILE="$LOG_DIR/cron-storage-monitor.log"
|
||||
LOCK_FILE="$LOG_DIR/storage_monitor.lock"
|
||||
|
||||
exec 201>"$LOCK_FILE"
|
||||
if ! flock -n 201; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
timestamp() {
|
||||
date --iso-8601=seconds
|
||||
}
|
||||
|
||||
echo "[$(timestamp)] Starting storage:monitor" >> "$LOG_FILE"
|
||||
if /usr/bin/env php artisan storage:monitor --no-interaction --quiet >> "$LOG_FILE" 2>&1; then
|
||||
echo "[$(timestamp)] storage:monitor completed" >> "$LOG_FILE"
|
||||
else
|
||||
status=$?
|
||||
echo "[$(timestamp)] storage:monitor failed (exit $status)" >> "$LOG_FILE"
|
||||
exit $status
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Upload queue health cron skeleton
|
||||
# Upload queue health cron job
|
||||
# Schedule every 10 minutes to detect stalled uploads
|
||||
|
||||
set -euo pipefail
|
||||
@@ -8,6 +8,25 @@ set -euo pipefail
|
||||
APP_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$APP_DIR"
|
||||
|
||||
# Artisan command should inspect queue lengths and stuck assets
|
||||
/usr/bin/env php artisan storage:check-upload-queues --quiet
|
||||
LOG_DIR="$APP_DIR/storage/logs"
|
||||
mkdir -p "$LOG_DIR"
|
||||
LOG_FILE="$LOG_DIR/cron-upload-queue-health.log"
|
||||
LOCK_FILE="$LOG_DIR/upload_queue_health.lock"
|
||||
|
||||
exec 202>"$LOCK_FILE"
|
||||
if ! flock -n 202; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
timestamp() {
|
||||
date --iso-8601=seconds
|
||||
}
|
||||
|
||||
echo "[$(timestamp)] Starting storage:check-upload-queues" >> "$LOG_FILE"
|
||||
if /usr/bin/env php artisan storage:check-upload-queues --no-interaction --quiet >> "$LOG_FILE" 2>&1; then
|
||||
echo "[$(timestamp)] storage:check-upload-queues completed" >> "$LOG_FILE"
|
||||
else
|
||||
status=$?
|
||||
echo "[$(timestamp)] storage:check-upload-queues failed (exit $status)" >> "$LOG_FILE"
|
||||
exit $status
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user