#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)" # shellcheck disable=SC1091 source "$SCRIPT_DIR/common.sh" if [ ! -f "$ENV_FILE" ]; then echo "env file missing: $ENV_FILE" >&2 exit 1 fi install_unit() { local name="$1" local src local dst src="$ROOT_DIR/systemd/$(service_unit_name "$name")" dst="/etc/systemd/system/$(service_unit_name "$name")" if [ ! -f "$src" ]; then echo "systemd unit missing: $src" >&2 exit 1 fi install -m 0644 "$src" "$dst" } install_extra_unit() { local unit="$1" local src local dst src="$ROOT_DIR/systemd/$unit" dst="/etc/systemd/system/$unit" if [ ! -f "$src" ]; then echo "systemd unit missing: $src" >&2 exit 1 fi install -m 0644 "$src" "$dst" } name="" for name in $(suite_service_names); do install_unit "$name" done install_extra_unit "hy-app-monitor-cleanup.service" install_extra_unit "hy-app-monitor-cleanup.timer" chmod +x "$ROOT_DIR"/scripts/*.sh stop_all_legacy_processes systemctl daemon-reload for name in $(suite_service_names); do systemctl enable "$(service_unit_name "$name")" done systemctl enable --now hy-app-monitor-cleanup.timer