#!/usr/bin/env bash set -euo pipefail BASE="${FURNITURE_PROD_BASE:-/opt/furniture-3d-system-prod}" APP_ROOT="$BASE/current/furniture-3d-system" SERVICE_NAME="${PRODUCT_INVENTORY_SNAPSHOT_SERVICE_NAME:-furniture-product-inventory-snapshot}" SYNC_ENV="$BASE/shared/product-inventory-snapshot.env" CALENDAR="${PRODUCT_INVENTORY_SNAPSHOT_CALENDAR:-*:0/15}" if [ "$(id -u)" -ne 0 ]; then echo "This installer requires root." >&2 exit 1 fi if [ ! -f "$APP_ROOT/scripts/sync-product-inventory-snapshot.ts" ]; then echo "Missing deployed snapshot script: $APP_ROOT/scripts/sync-product-inventory-snapshot.ts" >&2 exit 1 fi if [ ! -f "$SYNC_ENV" ]; then umask 077 cat >"$SYNC_ENV" <"/etc/systemd/system/$SERVICE_NAME.service" <"/etc/systemd/system/$SERVICE_NAME.timer" <