deploy: launchd plist template + install script for tt autotrack cutover
56f17709ff93ede57392abb605fff5dca8412c59
Kevin Kortum <kevinkortum@me.com> · 2026-07-08 13:07
parent 967daa44
2 files changed
deploy/autotrack.plist.template +23 −0
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>com.humdrum.ticktock.autotrack</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>@TT@</string>
+ <string>autotrack</string>
+ </array>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>KeepAlive</key>
+ <true/>
+ <key>ProcessType</key>
+ <string>Background</string>
+ <key>StandardOutPath</key>
+ <string>@HOME@/.local/share/ticktock/autotrack.log</string>
+ <key>StandardErrorPath</key>
+ <string>@HOME@/.local/share/ticktock/autotrack.err</string>
+</dict>
+</plist>
deploy/install-autotrack.sh +24 −0
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+# Repoint the com.humdrum.ticktock.autotrack launchd agent at `tt autotrack`.
+#
+# Rollback: the Python daemon in ticktock-old is untouched — re-run
+# ~/Developer/Home/ticktock-old/daemon/install-daemon.sh
+# (note: it installs under the old com.ticktock.autotrack label; bootout the
+# com.humdrum one first) or hand-edit the plist back to autotrack.py.
+set -euo pipefail
+REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+TT="$REPO/bin/tt"
+LABEL="com.humdrum.ticktock.autotrack"
+PLIST="${HOME}/Library/LaunchAgents/${LABEL}.plist"
+
+[ -x "$TT" ] || { echo "missing $TT — run: make build helpers" >&2; exit 1; }
+mkdir -p "${HOME}/.local/share/ticktock" "${HOME}/Library/LaunchAgents"
+
+sed -e "s#@TT@#${TT}#g" -e "s#@HOME@#${HOME}#g" \
+ "$REPO/deploy/autotrack.plist.template" > "$PLIST"
+
+launchctl bootout "gui/$(id -u)/${LABEL}" 2>/dev/null || true
+launchctl bootstrap "gui/$(id -u)" "$PLIST"
+echo "✓ ${LABEL} → ${TT} autotrack (${PLIST})"
+echo " verify: launchctl print gui/$(id -u)/${LABEL} | grep -E 'state|program'"
+echo " logs: tail -f ~/.local/share/ticktock/autotrack.err"