Spaces:
Sleeping
Sleeping
| # macOS launchd installer for the Sangsangfinder iMessage notification worker. | |
| # | |
| # ์ค์น: bash scripts/setup_notifications.sh install | |
| # ์ ๊ฑฐ: bash scripts/setup_notifications.sh uninstall | |
| # ์ํ: bash scripts/setup_notifications.sh status | |
| set -euo pipefail | |
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | |
| PLIST_NAME="com.sangsangfinder.notifications.plist" | |
| PLIST_SRC="$SCRIPT_DIR/$PLIST_NAME" | |
| AGENTS_DIR="$HOME/Library/LaunchAgents" | |
| PLIST_DST="$AGENTS_DIR/$PLIST_NAME" | |
| LABEL="com.sangsangfinder.notifications" | |
| CMD="${1:-install}" | |
| install() { | |
| if [ ! -f "$PLIST_SRC" ]; then | |
| echo "plist ํ์ผ์ ์ฐพ์ ์ ์์ต๋๋ค: $PLIST_SRC" | |
| exit 1 | |
| fi | |
| chmod +x "$SCRIPT_DIR/run_notification_worker.sh" | |
| mkdir -p "$AGENTS_DIR" | |
| launchctl unload "$PLIST_DST" 2>/dev/null || true | |
| cp "$PLIST_SRC" "$PLIST_DST" | |
| launchctl load "$PLIST_DST" | |
| echo "์๋ฆผ ์์ปค ์ค์น ์๋ฃ" | |
| echo " ์ํ ํ์ธ: launchctl list | grep $LABEL" | |
| echo " ๋ก๊ทธ ํ์ธ: tail -f $SCRIPT_DIR/notice_notification_worker.log" | |
| echo " ์ ๊ฑฐ: bash $SCRIPT_DIR/setup_notifications.sh uninstall" | |
| } | |
| uninstall() { | |
| launchctl unload "$PLIST_DST" 2>/dev/null || true | |
| rm -f "$PLIST_DST" | |
| echo "์๋ฆผ ์์ปค ์ ๊ฑฐ ์๋ฃ" | |
| } | |
| status() { | |
| echo "=== launchd ์ํ ===" | |
| launchctl list | grep "$LABEL" || echo "๋ฑ๋ก๋ job ์์" | |
| echo "" | |
| echo "=== ์ต๊ทผ ๋ก๊ทธ ===" | |
| tail -20 "$SCRIPT_DIR/notice_notification_worker.log" 2>/dev/null || echo "๋ก๊ทธ ํ์ผ ์์" | |
| } | |
| case "$CMD" in | |
| install) install ;; | |
| uninstall) uninstall ;; | |
| status) status ;; | |
| *) | |
| echo "์ฌ์ฉ๋ฒ: $0 {install|uninstall|status}" | |
| exit 1 | |
| ;; | |
| esac | |