sangsangfinder / scripts /setup_notifications.sh
cksleigen's picture
Initial clean deploy
54656fc
Raw
History Blame Contribute Delete
1.72 kB
#!/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