#!/usr/bin/env bash # Install the optional host-side Spotify poller as a systemd user timer (run as stan on the # server). Copies the units; enables the timer only with --enable (needs # ~/.config/music-collector.env, see README.md). Normally not needed: the app polls itself. set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" install -D -m 644 "$here/music-collector.service" "$HOME/.config/systemd/user/music-collector.service" install -D -m 644 "$here/music-collector.timer" "$HOME/.config/systemd/user/music-collector.timer" systemctl --user daemon-reload if [ "${1:-}" = --enable ]; then test -f "$HOME/.config/music-collector.env" || { echo 'Missing ~/.config/music-collector.env' >&2; exit 1; } systemctl --user enable --now music-collector.timer systemctl --user start music-collector.service || true systemctl --user --no-pager status music-collector.service | head -5 else echo 'Installed (not enabled). Enable with: bash deploy/music-collector/install.sh --enable' fi