17 lines
920 B
Bash
Executable File
17 lines
920 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# macOS: launchd 사용자 에이전트로 등록/갱신. 실행: bash deploy/install-launchd.sh
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
PLIST_SRC="$ROOT/deploy/com.sebrief.daemon.plist"
|
|
PLIST_DST="$HOME/Library/LaunchAgents/com.sebrief.daemon.plist"
|
|
mkdir -p "$ROOT/logs" "$HOME/Library/LaunchAgents"
|
|
# 프로젝트 경로가 다르면 plist 안의 경로를 현재 위치로 치환
|
|
sed "s#/Users/jsahn/Personal_works/sebrief#$ROOT#g" "$PLIST_SRC" > "$PLIST_DST"
|
|
launchctl bootout "gui/$(id -u)/com.sebrief.daemon" 2>/dev/null || true
|
|
launchctl bootstrap "gui/$(id -u)" "$PLIST_DST"
|
|
launchctl kickstart -k "gui/$(id -u)/com.sebrief.daemon"
|
|
echo "installed: $PLIST_DST"
|
|
echo "status: launchctl print gui/$(id -u)/com.sebrief.daemon | head -20"
|
|
echo "logs: tail -f $ROOT/logs/sebrief.log"
|
|
echo "remove: launchctl bootout gui/$(id -u)/com.sebrief.daemon && rm $PLIST_DST"
|