#!/bin/bash set -e mkdir -p database storage chmod 777 database storage # Create default cron settings on first deploy if [ ! -f storage/cron-settings.json ]; then echo '{"enabled":true,"interval_minutes":30,"last_run":null}' > storage/cron-settings.json fi chmod 666 storage/cron-settings.json # Ensure the import log exists and is writable by both cron (root) and Apache (www-data) touch storage/import.log chmod 666 storage/import.log composer install --no-interaction --quiet # Runs as root — migrations may create database/app.sqlite owned by root. php scripts/migrate.php up # Fix ownership after migrations so www-data (Apache) can write. # chmod works on Windows volume mounts even when chown is ignored by p9fs. chmod 777 database chmod 666 database/app.sqlite # Start cron daemon for the PrintStream background import service cron start exec apache2-foreground