-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_launchd.sh
More file actions
executable file
·32 lines (30 loc) · 940 Bytes
/
Copy pathsetup_launchd.sh
File metadata and controls
executable file
·32 lines (30 loc) · 940 Bytes
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
#!/bin/bash
# Install/uninstall codebuddy2api as a macOS LaunchAgent (auto-start on login)
set -e
PLIST_NAME="com.codebuddy2api.plist"
PLIST_SRC="$(cd "$(dirname "$0")" && pwd)/$PLIST_NAME"
PLIST_DST="$HOME/Library/LaunchAgents/$PLIST_NAME"
LOG_DIR="$(cd "$(dirname "$0")" && pwd)/logs"
case "${1:-install}" in
install)
mkdir -p "$LOG_DIR"
mkdir -p "$HOME/Library/LaunchAgents"
cp "$PLIST_SRC" "$PLIST_DST"
launchctl load "$PLIST_DST"
echo "Installed and loaded $PLIST_NAME"
echo "Service will auto-start on login."
echo "Logs: $LOG_DIR/"
;;
uninstall)
launchctl unload "$PLIST_DST" 2>/dev/null || true
rm -f "$PLIST_DST"
echo "Uninstalled $PLIST_NAME"
;;
status)
launchctl list | grep codebuddy2api || echo "Not loaded"
;;
*)
echo "Usage: $0 {install|uninstall|status}"
exit 1
;;
esac