Files
syn-chat-bot/manage_services.sh
hyungi 612933c2d3 Phase 5-6: API usage tracking + Calendar/Mail/DEVONthink/OmniFocus/News pipeline
- 파이프라인 42→51노드 확장 (calendar/mail/note 핸들러 추가)
- 네이티브 서비스 6개: heic_converter(:8090), chat_bridge(:8091),
  caldav_bridge(:8092), devonthink_bridge(:8093), inbox_processor, news_digest
- 분류기 v2→v3: calendar, reminder, mail, note intent 추가
- Mail Processing Pipeline (7노드, IMAP 폴링)
- LaunchAgent plist 6개 + manage_services.sh
- migrate-v3.sql: news_digest_log + calendar_events 확장
- 개발 문서 현행화 (CLAUDE.md, QUICK_REFERENCE.md, docs/architecture.md)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 17:09:04 +09:00

81 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# manage_services.sh — LaunchAgent 일괄 관리
# 사용법: ./manage_services.sh status | start | stop | restart
SERVICES=(
"com.syn-chat-bot.chat-bridge"
"com.syn-chat-bot.heic-converter"
"com.syn-chat-bot.caldav-bridge"
"com.syn-chat-bot.devonthink-bridge"
"com.syn-chat-bot.inbox-processor"
"com.syn-chat-bot.news-digest"
)
PLIST_DIR="$HOME/Library/LaunchAgents"
SRC_DIR="$(cd "$(dirname "$0")" && pwd)"
case "$1" in
status)
for s in "${SERVICES[@]}"; do
if launchctl list "$s" &>/dev/null; then
pid=$(launchctl list "$s" 2>/dev/null | awk 'NR==2{print $1}')
echo "$s: LOADED (PID: ${pid:-?})"
else
echo "$s: NOT LOADED"
fi
done
;;
start)
for s in "${SERVICES[@]}"; do
plist="$PLIST_DIR/${s}.plist"
src="$SRC_DIR/${s}.plist"
if [ ! -f "$plist" ] && [ -f "$src" ]; then
cp "$src" "$plist"
echo " Copied $s.plist to LaunchAgents"
fi
if [ -f "$plist" ]; then
launchctl load "$plist" 2>/dev/null
echo "$s: started"
else
echo "$s: plist not found"
fi
done
;;
stop)
for s in "${SERVICES[@]}"; do
plist="$PLIST_DIR/${s}.plist"
if [ -f "$plist" ]; then
launchctl unload "$plist" 2>/dev/null
echo "$s: stopped"
fi
done
;;
restart)
"$0" stop
sleep 1
"$0" start
;;
install)
echo "Installing plist files to $PLIST_DIR..."
for s in "${SERVICES[@]}"; do
src="$SRC_DIR/${s}.plist"
if [ -f "$src" ]; then
cp "$src" "$PLIST_DIR/"
echo "$s"
else
echo "$s: source plist not found"
fi
done
echo "Done. Run '$0 start' to start services."
;;
*)
echo "Usage: $0 {status|start|stop|restart|install}"
echo ""
echo " status - Show service status"
echo " start - Load and start all services"
echo " stop - Unload all services"
echo " restart - Stop then start"
echo " install - Copy plist files to ~/Library/LaunchAgents"
;;
esac