Spaces:
Sleeping
Sleeping
File size: 1,721 Bytes
54656fc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #!/usr/bin/env bash
# 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
|